Message ID | 1438934377-4922-32-git-send-email-a.hajda@samsung.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 376c0afe2f0047d091956a95e382e1edd104ea72 |
Headers | show |
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c index 4dadb5e..a5da91b 100644 --- a/sound/soc/soc-topology.c +++ b/sound/soc/soc-topology.c @@ -831,12 +831,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; }
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> --- sound/soc/soc-topology.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)