[U-Boot] [PATCH] fs/fat: Correct blk_dread() return value check

Tom Rini trini at konsulko.com
Tue Aug 15 01:02:08 UTC 2017


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 at konsulko.com>
---
 fs/fat/fat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 9ad18f96ff07..465a6875edf5 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -54,7 +54,7 @@ static int disk_read(__u32 block, __u32 nr_blocks, void *buf)
 
 	ret = blk_dread(cur_dev, cur_part_info.start + block, nr_blocks, buf);
 
-	if (nr_blocks && ret == 0)
+	if (ret != nr_blocks)
 		return -1;
 
 	return ret;
-- 
1.9.1



More information about the U-Boot mailing list