Skip to contentSkip to conversation

ASoC: topology: Return -ENOMEM on memory allocation failure

PATCH In review Amadeusz Sławiński 2 participants 2 messages Feb 7, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: topology: Return -ENOMEM on memory allocation failure

When handling error path, ret needs to be set to correct value.

Fixes d29d41e28eea ("ASoC: topology: Add support for multiple kcontrol types to a widget")
---
 sound/soc/soc-topology.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
sound/soc/soc-topology.c +6 -2
index 78223603088e..07421f5d4ebd 100644
@@ -1369,13 +1369,17 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg,
 
 	template.num_kcontrols = le32_to_cpu(w->num_kcontrols);
 	kc = devm_kcalloc(tplg->dev, le32_to_cpu(w->num_kcontrols), sizeof(*kc), GFP_KERNEL);
-	if (!kc)
+	if (!kc) {
+		ret = -ENOMEM;
 		goto hdr_err;
+	}
 
 	kcontrol_type = devm_kcalloc(tplg->dev, le32_to_cpu(w->num_kcontrols), sizeof(unsigned int),
 				     GFP_KERNEL);
-	if (!kcontrol_type)
+	if (!kcontrol_type) {
+		ret = -ENOMEM;
 		goto hdr_err;
+	}
 
 	for (i = 0; i < le32_to_cpu(w->num_kcontrols); i++) {
 		control_hdr = (struct snd_soc_tplg_ctl_hdr *)tplg->pos;
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 3 lines · Amadeusz Sławiński

When handling error path, ret needs to be set to correct value.

Applied to

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

Thanks!

[1/1] ASoC: topology: Return -ENOMEM on memory allocation failure

      commit: c173ee5b2fa6195066674d66d1d7e191010fb1ff

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

_______________________________________________
Alsa-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]