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: d4c750f2c7 ("ASoC: amd: acp: Add generic machine driver support for ACP cards")
Reported-by: TOTE Robot <oslab@tsinghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Link: https://lore.kernel.org/r/20220225131645.27556-1-baijiaju1990@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Jia-Ju Bai 2022-02-25 05:16:45 -08:00 committed by Mark Brown
parent 4d06f92f38
commit 431f9a77a4
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 2 additions and 0 deletions

View File

@ -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";