From: zhong jiang Date: Sat, 8 Sep 2018 08:36:20 +0000 (+0800) Subject: ASoC: skl-topology: Use kmemdup to replace kzalloc + memcpy X-Git-Tag: v5.4-rc1~2066^2~18^2~131 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ca92cc4636fdedf0d7ee88a5e50cd2b85c246a3b;p=platform%2Fkernel%2Flinux-rpi.git ASoC: skl-topology: Use kmemdup to replace kzalloc + memcpy kmemdup has implemented the function that kzalloc() + memcpy() will do. and we prefer to kmemdup rather than the open coded implementation. Signed-off-by: zhong jiang Signed-off-by: Mark Brown --- diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index 2620d77..52a9915 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c @@ -898,11 +898,10 @@ static int skl_tplg_set_module_bind_params(struct snd_soc_dapm_widget *w, bc = (struct skl_algo_data *)sb->dobj.private; if (bc->set_params == SKL_PARAM_BIND) { - params = kzalloc(bc->max, GFP_KERNEL); + params = kmemdup(bc->params, bc->max, GFP_KERNEL); if (!params) return -ENOMEM; - memcpy(params, bc->params, bc->max); skl_fill_sink_instance_id(ctx, params, bc->max, mconfig);