Skip to content

Commit

Permalink
ASoC: topology: use kmemdup rather than duplicating its implementation
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrzej Hajda authored and Mark Brown committed Aug 7, 2015
1 parent 4ca7deb commit 376c0af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sound/soc/soc-topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 376c0af

Please sign in to comment.