[PATCH v4 01/16] ASoC: amd: acp: fix missing cleanup on devm_kasprintf() failure in mc_probe()

From: Vijendar Mukunda

Date: Fri Oct 30 2026 - 05:49:03 EST


On devm_kasprintf() failure for the cfg-amp components string,
mc_probe() returned -ENOMEM directly without calling
asoc_sdw_mc_dailink_exit_loop(), leaving device references acquired
during sof_card_dai_links_create() unreleased.

Call asoc_sdw_mc_dailink_exit_loop() before returning -ENOMEM to
release those references, consistent with the cleanup already done
in the devm_snd_soc_register_card() failure path.

Fixes: cb8ea62e6402 ("ASoC: amd/sdw_utils: add sof based soundwire generic machine driver")
Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@xxxxxxx>
---
sound/soc/amd/acp/acp-sdw-sof-mach.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/amd/acp/acp-sdw-sof-mach.c b/sound/soc/amd/acp/acp-sdw-sof-mach.c
index ec3e1f5f1052..979048e42424 100644
--- a/sound/soc/amd/acp/acp-sdw-sof-mach.c
+++ b/sound/soc/amd/acp/acp-sdw-sof-mach.c
@@ -425,8 +425,10 @@ static int mc_probe(struct platform_device *pdev)

card->components = devm_kasprintf(&pdev->dev, GFP_KERNEL,
" cfg-amp:%d", amp_num);
- if (!card->components)
+ if (!card->components) {
+ asoc_sdw_mc_dailink_exit_loop(card);
return -ENOMEM;
+ }

/* Register the card */
ret = devm_snd_soc_register_card(&pdev->dev, card);
--
2.53.0