[PATCH 2/2] spi: cadence_qspi: Do not return unset error code

Andrew Goodbody andrew.goodbody at linaro.org
Tue Aug 12 13:34:39 CEST 2025


In spi_calibration if the low range fails to calibrate then the code
attempted to return the variable err but this has not been set in this
case. Instead just return -EIO.

This issue was found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody at linaro.org>
---
 drivers/spi/cadence_qspi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
index 9edbfaa821b..d8d9a4056fe 100644
--- a/drivers/spi/cadence_qspi.c
+++ b/drivers/spi/cadence_qspi.c
@@ -142,7 +142,7 @@ static int spi_calibration(struct udevice *bus, uint hz)
 
 	if (range_lo == -1) {
 		puts("SF: Calibration failed (low range)\n");
-		return err;
+		return -EIO;
 	}
 
 	/* Disable QSPI for subsequent initialization */

-- 
2.39.5



More information about the U-Boot mailing list