Unverified Commit 431f9a77 authored by Jia-Ju Bai's avatar Jia-Ju Bai Committed by Mark Brown
Browse files

ASoC: acp: check the return value of devm_kzalloc() in acp_legacy_dai_links_create()



The function devm_kzalloc() in acp_legacy_dai_links_create() can fail,
so its return value should be checked.

Fixes: d4c750f2 ("ASoC: amd: acp: Add generic machine driver support for ACP cards")
Reported-by: default avatarTOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: default avatarJia-Ju Bai <baijiaju1990@gmail.com>
Link: https://lore.kernel.org/r/20220225131645.27556-1-baijiaju1990@gmail.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4d06f92f
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -584,6 +584,8 @@ int acp_legacy_dai_links_create(struct snd_soc_card *card)
		num_links++;

	links = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link) * num_links, GFP_KERNEL);
	if (!links)
		return -ENOMEM;

	if (drv_data->hs_cpu_id == I2S_SP) {
		links[i].name = "acp-headset-codec";