Skip to content

Commit ca92cc4

Browse files
xiongzhongjiangbroonie
authored andcommitted
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 <zhongjiang@huawei.com> Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 18fbe80 commit ca92cc4

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sound/soc/intel/skylake/skl-topology.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -898,11 +898,10 @@ static int skl_tplg_set_module_bind_params(struct snd_soc_dapm_widget *w,
898898
bc = (struct skl_algo_data *)sb->dobj.private;
899899

900900
if (bc->set_params == SKL_PARAM_BIND) {
901-
params = kzalloc(bc->max, GFP_KERNEL);
901+
params = kmemdup(bc->params, bc->max, GFP_KERNEL);
902902
if (!params)
903903
return -ENOMEM;
904904

905-
memcpy(params, bc->params, bc->max);
906905
skl_fill_sink_instance_id(ctx, params, bc->max,
907906
mconfig);
908907

0 commit comments

Comments
 (0)