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>
/* 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;
}