summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorYihao Han <hanyihao@vivo.com>2022-03-17 02:38:41 -0700
committerMark Brown <broonie@kernel.org>2022-03-17 17:56:33 +0000
commitb26f965f7c83464f60d5af411ef9a03079e41800 (patch)
treec61b43cae06700a373f1250c3b996d7e5513bacf /sound
parent753132f0394b7e3cebe805a6c626a02e75766f7f (diff)
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: Yihao Han <hanyihao@vivo.com> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220317093841.3414-1-hanyihao@vivo.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/sof/topology.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sound/soc/sof/topology.c b/sound/soc/sof/topology.c
index 367fbe2d5b31..369693cc6d10 100644
--- a/sound/soc/sof/topology.c
+++ b/sound/soc/sof/topology.c
@@ -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;
}