[PATCH] ASoC: wm8994: Fix runtime PM imbalance in wm8994_component_probe()

Wentao Liang posted 1 patch 1 week, 1 day ago
sound/soc/codecs/wm8994.c | 2 ++
1 file changed, 2 insertions(+)
[PATCH] ASoC: wm8994: Fix runtime PM imbalance in wm8994_component_probe()
Posted by Wentao Liang 1 week, 1 day ago
In wm8994_component_probe(), pm_runtime_get_sync() is invoked before
reading the GPIO configuration registers. If either regmap_read() fails,
the function jumps to err_irq without calling pm_runtime_put(), leaving
the runtime PM usage count incremented and causing a leak.

Add pm_runtime_put() on both GPIO read failure paths before jumping to
err_irq.

Fixes: f5a2cda4f1db ("ASoC: wm8994: Ensure the device is resumed in wm89xx_mic_detect functions")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 sound/soc/codecs/wm8994.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 1d64c7c42ed1..7a790f5e33f1 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -4354,6 +4354,7 @@ static int wm8994_component_probe(struct snd_soc_component *component)
 	ret = regmap_read(control->regmap, WM8994_GPIO_1, &reg);
 	if (ret < 0) {
 		dev_err(component->dev, "Failed to read GPIO1 state: %d\n", ret);
+		pm_runtime_put(component->dev);
 		goto err_irq;
 	}
 	if ((reg & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) {
@@ -4366,6 +4367,7 @@ static int wm8994_component_probe(struct snd_soc_component *component)
 	ret = regmap_read(control->regmap, WM8994_GPIO_6, &reg);
 	if (ret < 0) {
 		dev_err(component->dev, "Failed to read GPIO6 state: %d\n", ret);
+		pm_runtime_put(component->dev);
 		goto err_irq;
 	}
 	if ((reg & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) {
-- 
2.34.1
Re: [PATCH] ASoC: wm8994: Fix runtime PM imbalance in wm8994_component_probe()
Posted by Mark Brown 1 week, 1 day ago
On Wed, 16 Sep 2026 07:27:37 +0000, Wentao Liang wrote:
> ASoC: wm8994: Fix runtime PM imbalance in wm8994_component_probe()

Applied to

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

Thanks!

[1/1] ASoC: wm8994: Fix runtime PM imbalance in wm8994_component_probe()
      https://git.kernel.org/broonie/sound/c/480a5528cb62

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
Re: [PATCH] ASoC: wm8994: Fix runtime PM imbalance in wm8994_component_probe()
Posted by Charles Keepax 1 week, 1 day ago
On Wed, Sep 16, 2026 at 07:27:37AM +0000, Wentao Liang wrote:
> In wm8994_component_probe(), pm_runtime_get_sync() is invoked before
> reading the GPIO configuration registers. If either regmap_read() fails,
> the function jumps to err_irq without calling pm_runtime_put(), leaving
> the runtime PM usage count incremented and causing a leak.
> 
> Add pm_runtime_put() on both GPIO read failure paths before jumping to
> err_irq.
> 
> Fixes: f5a2cda4f1db ("ASoC: wm8994: Ensure the device is resumed in wm89xx_mic_detect functions")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---

Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles