Skip to contentSkip to conversation

ASoC: codecs: lpass-rx-macro: fix PM ref leak in swclk_gate_enable

PATCH In review Tang Bin 3 participants 3 messages Oct 28 – Nov 2

Subsystems (4)
lore
Share & tools
lore

Tang Bin

author
#0 lore raw

PATCH 1/1 ASoC: codecs: lpass-rx-macro: fix PM ref leak in swclk_gate_enable

swclk_gate_enable() calls pm_runtime_resume_and_get() (incrementing the PM usage counter and, via of_pm_clk_add_clks, enabling mclk) before rx_macro_mclk_enable(). On rx_macro_mclk_enable() failure it called clk_disable_unprepare(rx->mclk) and returned, leaking the PM usage counter and potentially unbalancing the clock that the PM clock domain also manages. The sibling tx-macro/va-macro drivers call pm_runtime_put_autosuspend() here; do the same.

Fixes e38cbb75248a ("ASoC: codecs: lpass-rx-macro: Propagate regcache_sync() errors")
---
 sound/soc/codecs/lpass-rx-macro.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/lpass-rx-macro.c +1 -1
index 282a6aaa9..1737d525c 100644
@@ -3681,7 +3681,7 @@ static int swclk_gate_enable(struct clk_hw *hw)
 
 	ret = rx_macro_mclk_enable(rx, true);
 	if (ret) {
-		clk_disable_unprepare(rx->mclk);
+		pm_runtime_put_autosuspend(rx->dev);
 		return ret;
 	}
 
Signature · 1 line
2.52.0.windows.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Tang Bin

swclk_gate_enable() calls pm_runtime_resume_and_get() (incrementing the PM usage counter and, via of_pm_clk_add_clks, enabling mclk) before rx_macro_mclk_enable(). On rx_macro_mclk_enable() failure it called clk_disable_unprepare(rx->mclk) and returned, leaking the PM usage counter and potentially unbalancing the clock that the PM clock domain also manages. The sibling tx-macro/va-macro drivers call pm_runtime_put_autosuspend() here; do the same.

Fixes e38cbb75248a ("ASoC: codecs: lpass-rx-macro: Propagate regcache_sync() errors")

LGTM,

Thanks,
Prasad

maintainer
#2 lore raw
In reply to Tang Bin
Quoted 1 line · Tang Bin

ASoC: codecs: lpass-rx-macro: fix PM ref leak in swclk_gate_enable

Applied to

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

Thanks!

[1/1] ASoC: codecs: lpass-rx-macro: fix PM ref leak in swclk_gate_enable

      https://git.kernel.org/broonie/sound/c/e2df0223ba6d

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