aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-08-14 21:00:44 -0400
committerMarek Vasut <marex@denx.de>2017-08-21 11:31:11 +0200
commit6bafa5a4bd7c4d85f86178aee8adb6040d8df4a3 (patch)
tree2a662c93b6fefcb482de20dec4a82f6d4e0856a3 /common
parent2341c80cd261291aff2c58b70bacc053ecca9d1d (diff)
downloadu-boot-6bafa5a4bd7c4d85f86178aee8adb6040d8df4a3.zip
u-boot-6bafa5a4bd7c4d85f86178aee8adb6040d8df4a3.tar.gz
u-boot-6bafa5a4bd7c4d85f86178aee8adb6040d8df4a3.tar.bz2
fb_mmc.c: Correct blk_dread() return value checks
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. Cc: Lukasz Majewski <lukma@denx.de> Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'common')
-rw-r--r--common/fb_mmc.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/common/fb_mmc.c b/common/fb_mmc.c
index 2a8ba15..26d60b8 100644
--- a/common/fb_mmc.c
+++ b/common/fb_mmc.c
@@ -132,7 +132,7 @@ static lbaint_t fb_mmc_get_boot_header(struct blk_desc *dev_desc,
/* Read the boot image header */
res = blk_dread(dev_desc, info->start, hdr_sectors, (void *)hdr);
- if (res == 0) {
+ if (res != hdr_sectors) {
error("cannot read header from boot partition");
fastboot_fail("cannot read header from boot partition");
return 0;
@@ -215,7 +215,7 @@ static int fb_mmc_update_zimage(struct blk_desc *dev_desc,
ramdisk_buffer = (u8 *)hdr + (hdr_sectors * info.blksz);
res = blk_dread(dev_desc, ramdisk_sector_start, ramdisk_sectors,
ramdisk_buffer);
- if (res == 0) {
+ if (res != ramdisk_sectors) {
error("cannot read ramdisk from boot partition");
fastboot_fail("cannot read ramdisk from boot partition");
return -1;