mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 5/8] mci: am654-sdhci: fix error code printed in error messages
Date: Tue,  6 May 2025 08:34:43 +0200	[thread overview]
Message-ID: <20250506063446.3133582-5-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20250506063446.3133582-1-a.fatoum@pengutronix.de>

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




  parent reply	other threads:[~2025-05-06  6:38 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-06  6:34 [PATCH 1/8] treewide: replace dev_get_drvdata with device_get_match_data Ahmad Fatoum
2025-05-06  6:34 ` [PATCH 2/8] ARM: i.MX: esdctl: " Ahmad Fatoum
2025-05-06  6:34 ` [PATCH 3/8] driver: switch dev_get_drvdata to Linux semantics Ahmad Fatoum
2025-05-06  6:34 ` [PATCH 4/8] gpio: gpio-mxs: replace dev_get_drvdata with device_get_match_data Ahmad Fatoum
2025-05-06  7:42   ` Sascha Hauer
2025-05-06  6:34 ` Ahmad Fatoum [this message]
2025-05-06  6:34 ` [PATCH 6/8] pinctrl: at91: " Ahmad Fatoum
2025-05-06  6:34 ` [PATCH 7/8] drivers: maintain const when converting from struct driver Ahmad Fatoum
2025-05-06  6:34 ` [PATCH 8/8] driver: base: invert driver match callback for Linux compatibility Ahmad Fatoum
2025-05-06  7:41 ` [PATCH 1/8] treewide: replace dev_get_drvdata with device_get_match_data Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250506063446.3133582-5-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox