summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrzej Hajda <a.hajda@samsung.com>2015-08-07 09:59:37 +0200
committerMark Brown <broonie@kernel.org>2015-08-07 14:27:51 +0200
commit376c0afe2f0047d091956a95e382e1edd104ea72 (patch)
tree0f9bc883b46ec5d3e44e6fe72d38e7b70422b81e
parentASoC: topology: Use kcalloc instead of kzalloc for array allocation (diff)
downloadlinux-376c0afe2f0047d091956a95e382e1edd104ea72.tar.xz
linux-376c0afe2f0047d091956a95e382e1edd104ea72.zip
ASoC: topology: use kmemdup rather than duplicating its implementation
The patch was generated using fixed coccinelle semantic patch scripts/coccinelle/api/memdup.cocci [1]. [1]: http://permalink.gmane.org/gmane.linux.kernel/2014320 Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/soc-topology.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index f038c6ef8005..8620dbf410c6 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -832,12 +832,12 @@ static int soc_tplg_denum_create_values(struct soc_enum *se,
if (ec->items > sizeof(*ec->values))
return -EINVAL;
- se->dobj.control.dvalues =
- kmalloc(ec->items * sizeof(u32), GFP_KERNEL);
+ se->dobj.control.dvalues = kmemdup(ec->values,
+ ec->items * sizeof(u32),
+ GFP_KERNEL);
if (!se->dobj.control.dvalues)
return -ENOMEM;
- memcpy(se->dobj.control.dvalues, ec->values, ec->items * sizeof(u32));
return 0;
}