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 3/3] ARM: rpi: return correct error code when failing to read revision
Date: Wed, 11 Sep 2024 10:17:47 +0200	[thread overview]
Message-ID: <20240911081747.1523613-3-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240911081747.1523613-1-a.fatoum@pengutronix.de>

When rpi_get_dcfg() returned an error, ret wasn't set and continued to
hold the value of the hardware revision, which would be used as return
value for the initcall.

rpi_get_dcfg() already prints an error message with the HW revision when
returning an error pointer, so passing along the extra error code
results in no loss of information.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 arch/arm/boards/raspberry-pi/rpi-common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/boards/raspberry-pi/rpi-common.c b/arch/arm/boards/raspberry-pi/rpi-common.c
index 7a3911e36fa1..754772da460f 100644
--- a/arch/arm/boards/raspberry-pi/rpi-common.c
+++ b/arch/arm/boards/raspberry-pi/rpi-common.c
@@ -552,8 +552,10 @@ static int rpi_devices_probe(struct device *dev)
 	priv->hw_id = ret;
 
 	dcfg = rpi_get_dcfg(priv);
-	if (IS_ERR(dcfg))
+	if (IS_ERR(dcfg)) {
+		ret = PTR_ERR(dcfg);
 		goto free_priv;
+	}
 
 	/* construct short recognizable host name */
 	name = of_device_get_match_compatible(priv->dev);
-- 
2.39.2




  parent reply	other threads:[~2024-09-11  8:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-11  8:17 [PATCH 1/3] ARM: rpi: turn fixup message into debug messages Ahmad Fatoum
2024-09-11  8:17 ` [PATCH 2/3] ARM: rpi: always add built-in env Ahmad Fatoum
2024-09-11  8:17 ` Ahmad Fatoum [this message]
2024-09-11  8:29 ` [PATCH 1/3] ARM: rpi: turn fixup message into debug messages 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=20240911081747.1523613-3-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