[PATCH 5/8] mci: am654-sdhci: fix error code printed in error messages

Ahmad Fatoum a.fatoum at pengutronix.de
Mon May 5 23:34:43 PDT 2025


The error code returned on clock failures is a stale value of ret, which
is likely to be zero.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/mci/am654-sdhci.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/mci/am654-sdhci.c b/drivers/mci/am654-sdhci.c
index b4735952515f..3e637c56850f 100644
--- a/drivers/mci/am654-sdhci.c
+++ b/drivers/mci/am654-sdhci.c
@@ -575,21 +575,13 @@ static int am654_sdhci_probe(struct device *dev)
                 return PTR_ERR(plat->base);
         }
 
-	plat->clk = clk_get(dev, "clk_xin");
-	if (IS_ERR(plat->clk)) {
-		dev_err(dev, "failed to get clock\n");
-		return ret;
-	}
+	plat->clk = clk_get_enabled(dev, "clk_xin");
+	if (IS_ERR(plat->clk))
+		return dev_errp_probe(dev, plat->clk, "failed to get clock\n");
 
-	clk_enable(plat->clk);
-
-	plat->clk_ahb = clk_get(dev, "clk_ahb");
-	if (IS_ERR(plat->clk_ahb)) {
-		dev_err(dev, "failed to get ahb clock\n");
-		return ret;
-	}
-
-	clk_enable(plat->clk_ahb);
+	plat->clk_ahb = clk_get_enabled(dev, "clk_ahb");
+	if (IS_ERR(plat->clk_ahb))
+		return dev_errp_probe(dev, plat->clk, "failed to get ahb clock\n");
 
 	mci = &plat->mci;
 	mci->f_max = clk_get_rate(plat->clk);
-- 
2.39.5




More information about the barebox mailing list