spl: spl_mmc.c Correct blk_dread() return value check
authorTom Rini <trini@konsulko.com>
Tue, 15 Aug 2017 01:01:30 +0000 (21:01 -0400)
committerTom Rini <trini@konsulko.com>
Sun, 20 Aug 2017 13:54:30 +0000 (09:54 -0400)
The function blk_dread will return -ENOSYS on failure or on success the
number of blocks read, which must be the number asked to read (otherwise
it failed somewhere).  Correct this check.

Signed-off-by: Tom Rini <trini@konsulko.com>
common/spl/spl_mmc.c

index d95f94ca15e0b4b07c4a894247044391be816c9d..b2cccc6c6e41ca450e49cd68fc28516187d8372e 100644 (file)
@@ -200,7 +200,7 @@ static int mmc_load_image_raw_os(struct spl_image_info *spl_image,
                CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR,
                CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS,
                (void *) CONFIG_SYS_SPL_ARGS_ADDR);
-       if (count == 0) {
+       if (count != CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS) {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
                puts("mmc_load_image_raw_os: mmc block read error\n");
 #endif