]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spi: Correct two error return values
authorSimon Glass <sjg@chromium.org>
Wed, 24 Feb 2016 16:14:56 +0000 (09:14 -0700)
committerSimon Glass <sjg@chromium.org>
Fri, 26 Feb 2016 15:53:10 +0000 (08:53 -0700)
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@chromium.org>
Fixes: 1e90d9fd (sf: Move read_id code to sf_ops)
Reviewed-by: Jagan Teki <jteki@openedev.com>
Tested-by: Jagan Teki <jteki@openedev.com>
drivers/mtd/spi/sf_probe.c
drivers/mtd/spi/spi_flash.c

index daa1d5b249ea93c2f4b9c067b02f27543e8ddfae..7b296378d2be4fa20a274219a63ae93fee95eae4 100644 (file)
@@ -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);
index 3c365d5e9ad8f94b11fd96388dbf934c58e7f5a6..2ae2e3c8c9ad592713a4a5fd4c9448c343f98745 100644 (file)
@@ -989,7 +989,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