mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci-s3c: handle interface clock enable failures
@ 2026-11-29 12:58 Jiawen Liu
  2026-11-29 19:44 ` Markus Elfring
  0 siblings, 1 reply; 2+ messages in thread
From: Jiawen Liu @ 2026-11-29 12:58 UTC (permalink / raw)
  To: Ben Dooks, Jaehoon Chung, Adrian Hunter, Ulf Hansson
  Cc: linux-mmc, linux-kernel

sdhci_s3c_probe() ignores the result of enabling the hsmmc interface
clock. The clock helper unwinds partial preparation on failure, but probe
continues into controller setup without a successful enable. A later
probe error also reaches cleanup that assumes the clock was enabled.

Propagate the original error immediately and leave the successful-enable
cleanup labels for paths that actually acquired the reference.

Fixes: 0f310a057feb ("mmc: sdhci-s3c: use clk_prepare_enable and clk_disable_unprepare")
Signed-off-by: Jiawen Liu <1298662399@qq.com>
---
 drivers/mmc/host/sdhci-s3c.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
index ca6120adb21ed..e847ed93a42e9 100644
--- a/drivers/mmc/host/sdhci-s3c.c
+++ b/drivers/mmc/host/sdhci-s3c.c
@@ -534,7 +534,9 @@ static int sdhci_s3c_probe(struct platform_device *pdev)
 	}
 
 	/* 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)
+		return dev_err_probe(dev, ret, "failed to enable io clock\n");
 
 	for (clks = 0, ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
 		char name[14];
-- 
2.34.1


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

* Re: [PATCH] mmc: sdhci-s3c: handle interface clock enable failures
  2026-11-29 12:58 [PATCH] mmc: sdhci-s3c: handle interface clock enable failures Jiawen Liu
@ 2026-11-29 19:44 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2026-11-29 19:44 UTC (permalink / raw)
  To: Jiawen Liu, linux-mmc, Adrian Hunter, Ben Dooks, Jaehoon Chung,
	Ulf Hansson
  Cc: LKML, kernel-janitors, Andy Shevchenko, Christophe Jaillet,
	Fabio Estevam, Florian Fainelli, Frank Li, H. Nikolaus Schaller

> sdhci_s3c_probe() ignores the result of enabling the hsmmc interface
> clock. The clock helper unwinds partial preparation on failure, but probe
> continues into controller setup without a successful enable. A later
> probe error also reaches cleanup that assumes the clock was enabled.
> 
> Propagate the original error immediately and leave the successful-enable
> cleanup labels for paths that actually acquired the reference.

Will the function “devm_clk_get_enabled” become applicable once more?
https://elixir.bootlin.com/linux/v7.4-rc2/source/include/linux/clk.h#L615-L632
https://elixir.bootlin.com/linux/v7.4-rc2/source/drivers/mmc/host/sdhci-s3c.c#L530-L537

Regards,
Markus

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-29 12:58 [PATCH] mmc: sdhci-s3c: handle interface clock enable failures Jiawen Liu
2026-11-29 19:44 ` Markus Elfring

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®