/* 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;
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;