mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: arizona-jack: Fix runtime PM imbalance in arizona_start_hpdet_acc_id()
@ 2026-09-16  7:29 Wentao Liang
  2026-09-16  9:59 ` Charles Keepax
  0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2026-09-16  7:29 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, linux-kernel, linux-sound, patches, perex, tiwai,
	Wentao Liang, stable

In arizona_start_hpdet_acc_id(), pm_runtime_get_sync() is called to keep
the device powered during headphone detection. If setting the HPDET mode
or starting the measurement fails and the function jumps to err,
pm_runtime_put_autosuspend() was not called while info->hpdet_active was
set to false, resulting in a runtime PM usage count leak.

Add pm_runtime_put_autosuspend() in the err error path to keep runtime PM
balanced.

Fixes: 9dd5e53d9d2f ("extcon: arizona: Retry HPDET identification for high impedance")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 sound/soc/codecs/arizona-jack.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/codecs/arizona-jack.c b/sound/soc/codecs/arizona-jack.c
index a9063bac2752..c84e4961655f 100644
--- a/sound/soc/codecs/arizona-jack.c
+++ b/sound/soc/codecs/arizona-jack.c
@@ -698,6 +698,7 @@ static void arizona_start_hpdet_acc_id(struct arizona_priv *info)
 	snd_soc_jack_report(info->jack, SND_JACK_HEADPHONE,
 			    SND_JACK_LINEOUT | SND_JACK_HEADPHONE);
 
+	pm_runtime_put_autosuspend(arizona->dev);
 	info->hpdet_active = false;
 }
 
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: arizona-jack: Fix runtime PM imbalance in arizona_start_hpdet_acc_id()
  2026-09-16  7:29 [PATCH] ASoC: arizona-jack: Fix runtime PM imbalance in arizona_start_hpdet_acc_id() Wentao Liang
@ 2026-09-16  9:59 ` Charles Keepax
  0 siblings, 0 replies; 2+ messages in thread
From: Charles Keepax @ 2026-09-16  9:59 UTC (permalink / raw)
  To: Wentao Liang
  Cc: broonie, lgirdwood, linux-kernel, linux-sound, patches, perex,
	tiwai, stable

On Wed, Sep 16, 2026 at 07:29:00AM +0000, Wentao Liang wrote:
> In arizona_start_hpdet_acc_id(), pm_runtime_get_sync() is called to keep
> the device powered during headphone detection. If setting the HPDET mode
> or starting the measurement fails and the function jumps to err,
> pm_runtime_put_autosuspend() was not called while info->hpdet_active was
> set to false, resulting in a runtime PM usage count leak.
> 
> Add pm_runtime_put_autosuspend() in the err error path to keep runtime PM
> balanced.
> 
> Fixes: 9dd5e53d9d2f ("extcon: arizona: Retry HPDET identification for high impedance")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  sound/soc/codecs/arizona-jack.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/sound/soc/codecs/arizona-jack.c b/sound/soc/codecs/arizona-jack.c
> index a9063bac2752..c84e4961655f 100644
> --- a/sound/soc/codecs/arizona-jack.c
> +++ b/sound/soc/codecs/arizona-jack.c
> @@ -698,6 +698,7 @@ static void arizona_start_hpdet_acc_id(struct arizona_priv *info)
>  	snd_soc_jack_report(info->jack, SND_JACK_HEADPHONE,
>  			    SND_JACK_LINEOUT | SND_JACK_HEADPHONE);
>  
> +	pm_runtime_put_autosuspend(arizona->dev);
>  	info->hpdet_active = false;
>  }

Code is quite complex here but I think this looks good to me:

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:00 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:29 [PATCH] ASoC: arizona-jack: Fix runtime PM imbalance in arizona_start_hpdet_acc_id() Wentao Liang
2026-09-16  9:59 ` 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®