Linux MultiMedia Card development
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-s3c: check clk_prepare_enable return in probe
@ 2026-08-18 13:07 Jiawen Liu
  2026-08-20  8:52 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Jiawen Liu @ 2026-08-18 13:07 UTC (permalink / raw)
  To: Adrian Hunter, Ben Dooks, Jaehoon Chung, linux-mmc, linux-kernel

sdhci_s3c_probe() ignores the return value of
clk_prepare_enable(sc->clk_io). If this call fails, the clock is not
enabled, but the driver continues and later calls
clk_disable_unprepare() on it, leading to an unbalanced clock
disable/unprepare.

Fix this by checking the return value and propagating the error,
cleaning up only resources acquired before the failed enable.

Signed-off-by: jiawen <1298662399@qq.com>
---
diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -534,7 +534,11 @@
 	}
 
 	/* enable the local io clock and keep it running for the moment. */
-	clk_prepare_enable(sc->clk_io);
+	ret = clk_prepare_enable(sc->clk_io);
+	if (ret) {
+		dev_err(dev, "failed to enable io clock\n");
+		return ret;
+	}
 
 	for (clks = 0, ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
 		char name[14];


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

* Re: [PATCH] mmc: sdhci-s3c: check clk_prepare_enable return in probe
  2026-08-18 13:07 [PATCH] mmc: sdhci-s3c: check clk_prepare_enable return in probe Jiawen Liu
@ 2026-08-20  8:52 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2026-08-20  8:52 UTC (permalink / raw)
  To: 1298662399, linux-mmc, Adrian Hunter, Ben Dooks, Jaehoon Chung
  Cc: LKML, kernel-janitors

…
> Fix this by checking the return value and propagating the error,
> cleaning up only resources acquired before the failed enable.

How do you think about to add any tags (like “Fixes” and “Cc”) accordingly?

See also once more:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/stable-kernel-rules.rst?h=v7.2#n34
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v7.2#n145
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v7.2#n792

Regards,
Markus

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

end of thread, other threads:[~2026-08-20  8:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-18 13:07 [PATCH] mmc: sdhci-s3c: check clk_prepare_enable return in probe Jiawen Liu
2026-08-20  8:52 ` Markus Elfring

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