[PATCH] ASoC: codecs: wm8994: Fix runtime PM leak in wm8994_mic_detect()

Wentao Liang posted 1 patch 1 week ago
sound/soc/codecs/wm8994.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] ASoC: codecs: wm8994: Fix runtime PM leak in wm8994_mic_detect()
Posted by Wentao Liang 1 week ago
wm8994_mic_detect() resumes the component before configuring the MICBIAS
pins, but the default case of the micbias switch returns -EINVAL right
after taking that reference, skipping the pm_runtime_put() on the
success path. This leaks a runtime PM reference on every call with an
invalid micbias.

Release the reference before returning -EINVAL.

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 | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 1d64c7c42ed1..bfbb8a56b563 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -3535,6 +3535,7 @@ int wm8994_mic_detect(struct snd_soc_component *component, struct snd_soc_jack *
 		break;
 	default:
 		dev_warn(component->dev, "Invalid MICBIAS %d\n", micbias);
+		pm_runtime_put(component->dev);
 		return -EINVAL;
 	}
 
-- 
2.34.1
Re: [PATCH] ASoC: codecs: wm8994: Fix runtime PM leak in wm8994_mic_detect()
Posted by Mark Brown 6 days, 7 hours ago
On Thu, 17 Sep 2026 16:51:30 +0000, Wentao Liang wrote:
> ASoC: codecs: wm8994: Fix runtime PM leak in wm8994_mic_detect()

Applied to

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

Thanks!

[1/1] ASoC: codecs: wm8994: Fix runtime PM leak in wm8994_mic_detect()
      https://git.kernel.org/broonie/sound/c/b2c0e5bf750e

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: codecs: wm8994: Fix runtime PM leak in wm8994_mic_detect()
Posted by Charles Keepax 6 days, 9 hours ago
On Thu, Sep 17, 2026 at 04:51:30PM +0000, Wentao Liang wrote:
> wm8994_mic_detect() resumes the component before configuring the MICBIAS
> pins, but the default case of the micbias switch returns -EINVAL right
> after taking that reference, skipping the pm_runtime_put() on the
> success path. This leaks a runtime PM reference on every call with an
> invalid micbias.
> 
> Release the reference before returning -EINVAL.
> 
> 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