mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: ti: davinci-mcasp: Fix runtime PM imbalance in __davinci_mcasp_set_clkdiv()
@ 2026-09-16  7:31 Wentao Liang
  2026-09-16  7:53 ` Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Wentao Liang @ 2026-09-16  7:31 UTC (permalink / raw)
  To: broonie
  Cc: lgirdwood, linux-kernel, linux-sound, perex, sen, tiwai, zonque,
	Wentao Liang, stable

In __davinci_mcasp_set_clkdiv(), pm_runtime_get_sync() is called at the
entry of the function. If an invalid div_id is provided, the function
hits the default switch case and directly returns -EINVAL without calling
pm_runtime_put(), resulting in a runtime PM reference leak.

Add pm_runtime_put() in the default case before returning -EINVAL.

Fixes: 4ed8c9b737b6 ("ASoC: McASP: add support for clock dividers")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 sound/soc/ti/davinci-mcasp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
index f229f847eaf4..1ec42fe02fc8 100644
--- a/sound/soc/ti/davinci-mcasp.c
+++ b/sound/soc/ti/davinci-mcasp.c
@@ -786,6 +786,7 @@ static int __davinci_mcasp_set_clkdiv(struct davinci_mcasp *mcasp, int div_id,
 		break;
 
 	default:
+		pm_runtime_put(mcasp->dev);
 		return -EINVAL;
 	}
 
-- 
2.34.1


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

* Re: [PATCH] ASoC: ti: davinci-mcasp: Fix runtime PM imbalance in __davinci_mcasp_set_clkdiv()
  2026-09-16  7:31 [PATCH] ASoC: ti: davinci-mcasp: Fix runtime PM imbalance in __davinci_mcasp_set_clkdiv() Wentao Liang
@ 2026-09-16  7:53 ` Greg KH
  2026-09-16 18:56 ` Wang, Sen
  2026-09-22 13:52 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2026-09-16  7:53 UTC (permalink / raw)
  To: Wentao Liang
  Cc: broonie, lgirdwood, linux-kernel, linux-sound, perex, sen, tiwai,
	zonque, stable

On Wed, Sep 16, 2026 at 07:31:36AM +0000, Wentao Liang wrote:
> In __davinci_mcasp_set_clkdiv(), pm_runtime_get_sync() is called at the
> entry of the function. If an invalid div_id is provided, the function
> hits the default switch case and directly returns -EINVAL without calling
> pm_runtime_put(), resulting in a runtime PM reference leak.
> 
> Add pm_runtime_put() in the default case before returning -EINVAL.
> 
> Fixes: 4ed8c9b737b6 ("ASoC: McASP: add support for clock dividers")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  sound/soc/ti/davinci-mcasp.c | 1 +
>  1 file changed, 1 insertion(+)

Did you forget an "Assisted-by:" tag for all of these submissions?
If so, please fix up and send new ones.

thanks,

greg k-h

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

* Re: [PATCH] ASoC: ti: davinci-mcasp: Fix runtime PM imbalance in __davinci_mcasp_set_clkdiv()
  2026-09-16  7:31 [PATCH] ASoC: ti: davinci-mcasp: Fix runtime PM imbalance in __davinci_mcasp_set_clkdiv() Wentao Liang
  2026-09-16  7:53 ` Greg KH
@ 2026-09-16 18:56 ` Wang, Sen
  2026-09-22 13:52 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Wang, Sen @ 2026-09-16 18:56 UTC (permalink / raw)
  To: Wentao Liang, broonie
  Cc: lgirdwood, linux-kernel, linux-sound, perex, tiwai, zonque, stable

On 9/16/2026 2:31 AM, Wentao Liang wrote:
> In __davinci_mcasp_set_clkdiv(), pm_runtime_get_sync() is called at the
> entry of the function. If an invalid div_id is provided, the function
> hits the default switch case and directly returns -EINVAL without calling
> pm_runtime_put(), resulting in a runtime PM reference leak.
> 
> Add pm_runtime_put() in the default case before returning -EINVAL.
> 
> Fixes: 4ed8c9b737b6 ("ASoC: McASP: add support for clock dividers")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Hi Wentao, thanks for the catch!

Manual runtime PM reference is quite tedious and results in reference 
leak like you've pinpointed, maybe it's better to convert to a 
guard()/ACQUIRE() based approach in the future...

Assuming you took Greg's input if you need to submit a V2:

Tested-by: Sen Wang <sen@ti.com>

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

* Re: [PATCH] ASoC: ti: davinci-mcasp: Fix runtime PM imbalance in __davinci_mcasp_set_clkdiv()
  2026-09-16  7:31 [PATCH] ASoC: ti: davinci-mcasp: Fix runtime PM imbalance in __davinci_mcasp_set_clkdiv() Wentao Liang
  2026-09-16  7:53 ` Greg KH
  2026-09-16 18:56 ` Wang, Sen
@ 2026-09-22 13:52 ` Mark Brown
  2 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2026-09-22 13:52 UTC (permalink / raw)
  To: Wentao Liang
  Cc: lgirdwood, linux-kernel, linux-sound, perex, sen, tiwai, zonque, stable

On Wed, 16 Sep 2026 07:31:36 +0000, Wentao Liang wrote:
> ASoC: ti: davinci-mcasp: Fix runtime PM imbalance in __davinci_mcasp_set_clkdiv()

Applied to

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

Thanks!

[1/1] ASoC: ti: davinci-mcasp: Fix runtime PM imbalance in __davinci_mcasp_set_clkdiv()
      https://git.kernel.org/broonie/sound/c/ba593d662183

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


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

end of thread, other threads:[~2026-09-23  8:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16  7:31 [PATCH] ASoC: ti: davinci-mcasp: Fix runtime PM imbalance in __davinci_mcasp_set_clkdiv() Wentao Liang
2026-09-16  7:53 ` Greg KH
2026-09-16 18:56 ` Wang, Sen
2026-09-22 13:52 ` Mark Brown

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®