[PATCH] mmc: sdhci-s3c: handle interface clock enable failures

From: Jiawen Liu

Date: Sun Nov 29 2026 - 09:26:11 EST


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@xxxxxx>
---
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