[U-Boot] [PATCH 15/16] spi: Correct two error return values

Simon Glass sjg at chromium.org
Mon Feb 15 02:36:59 CET 2016


When an error number is provided we should use it, not change it. This fixes
the SPI and SPI flash tests.

One of these is long-standing. The other seems to have been introduced by
commit 1e90d9fd (sf: Move read_id code to sf_ops).

Signed-off-by: Simon Glass <sjg at chromium.org>
Fixes: 1e90d9fd (sf: Move read_id code to sf_ops)
---

 drivers/mtd/spi/sf_probe.c  | 4 +---
 drivers/mtd/spi/spi_flash.c | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index daa1d5b..7b29637 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -42,10 +42,8 @@ static int spi_flash_probe_slave(struct spi_flash *flash)
 	}
 
 	ret = spi_flash_scan(flash);
-	if (ret) {
-		ret = -EINVAL;
+	if (ret)
 		goto err_read_id;
-	}
 
 #ifdef CONFIG_SPI_FLASH_MTD
 	ret = spi_flash_mtd_register(flash);
diff --git a/drivers/mtd/spi/spi_flash.c b/drivers/mtd/spi/spi_flash.c
index 8a60c72..5c902f5 100644
--- a/drivers/mtd/spi/spi_flash.c
+++ b/drivers/mtd/spi/spi_flash.c
@@ -980,7 +980,7 @@ int spi_flash_scan(struct spi_flash *flash)
 	ret = spi_flash_cmd(spi, CMD_READ_ID, idcode, sizeof(idcode));
 	if (ret) {
 		printf("SF: Failed to get idcodes\n");
-		return -EINVAL;
+		return ret;
 	}
 
 #ifdef DEBUG
-- 
2.7.0.rc3.207.g0ac5344



More information about the U-Boot mailing list