[PATCH] ASoC: arizona-jack: Fix runtime PM imbalance in arizona_start_hpdet_acc_id()

Wentao Liang posted 1 patch 1 week, 1 day ago
sound/soc/codecs/arizona-jack.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] ASoC: arizona-jack: Fix runtime PM imbalance in arizona_start_hpdet_acc_id()
Posted by Wentao Liang 1 week, 1 day ago
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
Re: [PATCH] ASoC: arizona-jack: Fix runtime PM imbalance in arizona_start_hpdet_acc_id()
Posted by Mark Brown 1 week, 1 day ago
On Wed, 16 Sep 2026 07:29:00 +0000, Wentao Liang wrote:
> ASoC: arizona-jack: Fix runtime PM imbalance in arizona_start_hpdet_acc_id()

Applied to

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

Thanks!

[1/1] ASoC: arizona-jack: Fix runtime PM imbalance in arizona_start_hpdet_acc_id()
      https://git.kernel.org/broonie/sound/c/e04dcb895b46

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: arizona-jack: Fix runtime PM imbalance in arizona_start_hpdet_acc_id()
Posted by Charles Keepax 1 week, 1 day ago
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