[PATCH 3/3] ARM: rpi: return correct error code when failing to read revision

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Sep 11 01:17:47 PDT 2024


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




More information about the barebox mailing list