* [PATCH] ASoC: wm8994: Fix runtime PM imbalance in wm8994_component_probe()
@ 2026-09-16 7:27 Wentao Liang
2026-09-16 10:02 ` Charles Keepax
0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-09-16 7:27 UTC (permalink / raw)
To: broonie
Cc: ckeepax, krzk, lgirdwood, linux-kernel, linux-sound, patches,
perex, s.nawrocki, tiwai, Wentao Liang, stable
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, ®);
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, ®);
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: wm8994: Fix runtime PM imbalance in wm8994_component_probe()
2026-09-16 7:27 [PATCH] ASoC: wm8994: Fix runtime PM imbalance in wm8994_component_probe() Wentao Liang
@ 2026-09-16 10:02 ` Charles Keepax
0 siblings, 0 replies; 2+ messages in thread
From: Charles Keepax @ 2026-09-16 10:02 UTC (permalink / raw)
To: Wentao Liang
Cc: broonie, krzk, lgirdwood, linux-kernel, linux-sound, patches,
perex, s.nawrocki, tiwai, stable
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-09-16 10:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 7:27 [PATCH] ASoC: wm8994: Fix runtime PM imbalance in wm8994_component_probe() Wentao Liang
2026-09-16 10:02 ` Charles Keepax
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®