Commit b26f965f authored by Yihao Han's avatar Yihao Han Committed by Mark Brown

ASoC: SOF: topology: Use kmemdup() to replace kzalloc + memcpy

fix memdup.cocci warning:
sound/soc/sof/topology.c:876:19-26: WARNING opportunity for kmemdup

Generated by: scripts/coccinelle/api/memdup.cocci
Signed-off-by: default avatarYihao Han <hanyihao@vivo.com>
Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20220317093841.3414-1-hanyihao@vivo.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 753132f0
......@@ -873,11 +873,10 @@ static int sof_control_load_bytes(struct snd_soc_component *scomp,
/* copy the private data */
if (priv_size > 0) {
scontrol->priv = kzalloc(priv_size, GFP_KERNEL);
scontrol->priv = kmemdup(control->priv.data, priv_size, GFP_KERNEL);
if (!scontrol->priv)
return -ENOMEM;
memcpy(scontrol->priv, control->priv.data, priv_size);
scontrol->priv_size = priv_size;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment