Skip to content

Commit

Permalink
ASoC: acp: check the return value of devm_kzalloc() in acp_legacy_dai…
Browse files Browse the repository at this point in the history
…_links_create()

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

Fixes: d4c750f ("ASoC: amd: acp: Add generic machine driver support for ACP cards")
Reported-by: TOTE Robot <[email protected]>
Signed-off-by: Jia-Ju Bai <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
XidianGeneral authored and broonie committed Feb 25, 2022
1 parent 4d06f92 commit 431f9a7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sound/soc/amd/acp/acp-mach-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 431f9a7

Please sign in to comment.