Linux Sound subsystem development
 help / color / mirror / Atom feed
* [PATCH] ASoC: codecs: madera: release runtime PM ref on FLL config failure
@ 2026-11-04  2:28 Wentao Liang
  2026-11-04  2:42 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Wentao Liang @ 2026-11-04  2:28 UTC (permalink / raw)
  To: Charles Keepax, Richard Fitzgerald, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai
  Cc: linux-sound, patches

When the FLL is not already enabled, madera_fllhj_enable() takes a
runtime PM reference and relies on madera_fllhj_disable() to drop it
later. If madera_fllhj_apply() fails, the ENA bit is never set, so a
subsequent disable sees no change and does not drop the reference,
leaking it along with the device's active state.

Drop the reference on the failure path and skip waiting for a lock that
will never be asserted.

Fixes: 6535e831b4c8 ("ASoC: cs47l92: Add codec driver for Cirrus Logic CS47L92")
Cc: stable@vger.kernel.org
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 sound/soc/codecs/madera.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/sound/soc/codecs/madera.c b/sound/soc/codecs/madera.c
index 58255844b4df..2f6256f8e87b 100644
--- a/sound/soc/codecs/madera.c
+++ b/sound/soc/codecs/madera.c
@@ -4608,8 +4608,17 @@ static int madera_fllhj_enable(struct madera_fll *fll)
 			   MADERA_FLL1_HOLD_MASK,
 			   0);
 
-	if (!already_enabled)
-		madera_wait_for_fll(fll, true);
+	/*
+	 * If configuring the FLL failed it is left disabled, so a later
+	 * madera_fllhj_disable() will not see the ENA bit set and will not
+	 * drop the runtime PM reference taken above.
+	 */
+	if (!already_enabled) {
+		if (ret)
+			pm_runtime_put_autosuspend(madera->dev);
+		else
+			madera_wait_for_fll(fll, true);
+	}
 
 	return 0;
 }
-- 
2.34.1


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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-04  2:28 [PATCH] ASoC: codecs: madera: release runtime PM ref on FLL config failure Wentao Liang
2026-11-04  2:42 ` sashiko-bot
2026-11-05 11:11   ` Richard Fitzgerald
2026-11-04 11:00 ` Charles Keepax
2026-11-05  0:44 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox