Skip to contentSkip to conversation

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

PATCH In review Jia-Ju Bai 2 participants 2 messages Feb 25, 2022

Subsystems (3)
lore
Share & tools
lore

Jia-Ju Bai

author
#0 lore raw

PATCH 1/1 ALSA: 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 d4c750f2c7d4 ("ASoC: amd: acp: Add generic machine driver support for ACP cards")
---
 sound/soc/amd/acp/acp-mach-common.c | 2 ++
 1 file changed, 2 insertions(+)
sound/soc/amd/acp/acp-mach-common.c +2 -0
index cd05ee2802c9..5247015e8b31 100644
@@ -556,6 +556,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";
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 4 lines · Jia-Ju Bai

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

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ALSA: acp: check the return value of devm_kzalloc() in acp_legacy_dai_links_create()

      commit: 431f9a77a4a62694ce90742d1f4c5abe1b8b6612

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark