mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [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; 2+ 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	[flat|nested] 2+ 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
  0 siblings, 0 replies; 2+ 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] 2+ messages in thread

end of thread, other threads:[~2026-11-04 11:04 UTC | newest]

Thread overview: 2+ 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

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®