* [PATCH] ASoC: cs42l43: leak MCLK when PLL enable fails on PRE_PMU
@ 2026-11-04 8:02 Tang Bin
2026-11-04 11:04 ` Charles Keepax
0 siblings, 1 reply; 3+ messages in thread
From: Tang Bin @ 2026-11-04 8:02 UTC (permalink / raw)
To: david.rhodes, rf, lgirdwood, broonie, perex, tiwai
Cc: linux-sound, patches, linux-kernel, tangbin, stable
cs42l43_pll_ev() PRE_PMU arm enables mclk (when refclk_src is MCLK) then
calls cs42l43_enable_pll(). If PLL enable fails, ret is negative and DAPM
does not power up the widget, so POST_PMD never runs and the matching
clk_disable_unprepare(mclk) at line 1621 is skipped - mclk refcount leaked.
Roll back the mclk enable on PLL failure.
Fixes: fc918cbe874e ("ASoC: cs42l43: Add support for the cs42l43")
Cc: stable@vger.kernel.org
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
sound/soc/codecs/cs42l43.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/sound/soc/codecs/cs42l43.c b/sound/soc/codecs/cs42l43.c
index 1b817e1a6..0ac9e2361 100644
--- a/sound/soc/codecs/cs42l43.c
+++ b/sound/soc/codecs/cs42l43.c
@@ -1613,6 +1613,8 @@ static int cs42l43_pll_ev(struct snd_soc_dapm_widget *w,
}
ret = cs42l43_enable_pll(priv);
+ if (ret && priv->refclk_src == CS42L43_SYSCLK_MCLK)
+ clk_disable_unprepare(priv->mclk);
break;
case SND_SOC_DAPM_POST_PMD:
ret = cs42l43_disable_pll(priv);
--
2.52.0.windows.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] ASoC: cs42l43: leak MCLK when PLL enable fails on PRE_PMU
2026-11-04 8:02 [PATCH] ASoC: cs42l43: leak MCLK when PLL enable fails on PRE_PMU Tang Bin
@ 2026-11-04 11:04 ` Charles Keepax
2026-11-06 1:01 ` Tang Bin
0 siblings, 1 reply; 3+ messages in thread
From: Charles Keepax @ 2026-11-04 11:04 UTC (permalink / raw)
To: Tang Bin
Cc: david.rhodes, rf, lgirdwood, broonie, perex, tiwai, linux-sound,
patches, linux-kernel, stable
On Wed, Nov 04, 2026 at 04:02:57PM +0800, Tang Bin wrote:
> cs42l43_pll_ev() PRE_PMU arm enables mclk (when refclk_src is MCLK) then
> calls cs42l43_enable_pll(). If PLL enable fails, ret is negative and DAPM
> does not power up the widget, so POST_PMD never runs and the matching
> clk_disable_unprepare(mclk) at line 1621 is skipped - mclk refcount leaked.
> Roll back the mclk enable on PLL failure.
Could you point to the relevant bits of the core code here? My
understanding is that DAPM mostly just carrys on in the case of
an error from an event handler, so I would not expect the
sequence to play out as you describe.
Thanks,
Charles
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ASoC: cs42l43: leak MCLK when PLL enable fails on PRE_PMU
2026-11-04 11:04 ` Charles Keepax
@ 2026-11-06 1:01 ` Tang Bin
0 siblings, 0 replies; 3+ messages in thread
From: Tang Bin @ 2026-11-06 1:01 UTC (permalink / raw)
To: Charles Keepax
Cc: david.rhodes, rf, lgirdwood, broonie, perex, tiwai, linux-sound,
patches, linux-kernel, stable, Tang Bin
Hi Charles,
Thanks for the review and pointing this out.
On Wed, Nov 04, 2026 at 11:04:26AM +0000, Charles Keepax wrote:
> Could you point to the relevant bits of the core code here? My
> understanding is that DAPM mostly just carrys on in the case of
> an error from an event handler, so I would not expect the
> sequence to play out as you describe.
You are absolutely right. I dug into dapm_seq_check_event() in soc-dapm.c.
As you noted, if the event handler returns an error, DAPM only logs it
(via dev_err) but continues the power-up sequence.
Therefore, the widget is still marked as powered, and the matching POST_PMD
will indeed run and execute clk_disable_unprepare(mclk) as expected. There
is no reference count leak here.
My initial premise was incorrect. Please drop this patch.
Best regards,
Tang Bin
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-06 1:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04 8:02 [PATCH] ASoC: cs42l43: leak MCLK when PLL enable fails on PRE_PMU Tang Bin
2026-11-04 11:04 ` Charles Keepax
2026-11-06 1:01 ` Tang Bin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox