Skip to contentSkip to conversation

ASoC: codecs: wcd939x: fix regmap leak on probe failure

PATCH In review Johan Hovold 2 participants 2 messages Nov 27, 2025

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

PATCH 1/1 ASoC: codecs: wcd939x: fix regmap leak on probe failure

The soundwire regmap that may be allocated during probe is not freed on late probe failures.

Add the missing error handling.

Fixes be2af391cea0 ("ASoC: codecs: Add WCD939x Soundwire devices driver")
Cc Neil Armstrong <[email protected]>
---
 sound/soc/codecs/wcd939x-sdw.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
sound/soc/codecs/wcd939x-sdw.c +7 -1
index d369100a2457..da342a0c95a5 100644
@@ -1400,12 +1400,18 @@ static int wcd9390_probe(struct sdw_slave *pdev, const struct sdw_device_id *id)
 
 	ret = component_add(dev, &wcd_sdw_component_ops);
 	if (ret)
-		return ret;
+		goto err_free_regmap;
 
 	/* Set suspended until aggregate device is bind */
 	pm_runtime_set_suspended(dev);
 
 	return 0;
+
+err_free_regmap:
+	if (wcd->regmap)
+		regmap_exit(wcd->regmap);
+
+	return ret;
 }
 
 static int wcd9390_remove(struct sdw_slave *pdev)
Signature · 1 line
2.51.2
maintainer
#1 lore raw
Quoted 6 lines · Johan Hovold

The soundwire regmap that may be allocated during probe is not freed on late probe failures.

Add the missing error handling.

Applied to

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

Thanks!

[1/1] ASoC: codecs: wcd939x: fix regmap leak on probe failure

      commit: 86dc090f737953f16f8dc60c546ae7854690d4f6

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