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: be2af391ce ("ASoC: codecs: Add WCD939x Soundwire devices driver")
Cc: stable@vger.kernel.org	# 6.9
Cc: Neil Armstrong <neil.armstrong@linaro.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20251127135057.2216-1-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Johan Hovold 2025-11-27 14:50:57 +01:00 committed by Mark Brown
parent 6797540c8b
commit 86dc090f73
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -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)