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.
Reported-by: Coverity (CID: 166335)
Cc: Philipp Tomsich <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Bin Meng <[email protected]>
Signed-off-by: Tom Rini <[email protected]>
return 1;
}
- if (blk_dread(dev_desc, offset + blk, cnt, addr) < 0) {
+ if (blk_dread(dev_desc, offset + blk, cnt, addr) != cnt) {
printf("Error reading blocks\n");
return 1;
}