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

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.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 4d06f92f
......@@ -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";
......
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