From: Tom Rini Date: Mon, 14 Aug 2017 20:58:50 -0400 Subject: [U-Boot] [PATCH] cmd/read.c: Fix checking blk_dread return value Message-ID: <1502758730-26723-1-git-send-email-trini@konsulko.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 Cc: Simon Glass Cc: Bin Meng Signed-off-by: Tom Rini --- cmd/read.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/read.c b/cmd/read.c index ecf925426fcc..82c2d9ad994e 100644 --- a/cmd/read.c +++ b/cmd/read.c @@ -66,7 +66,7 @@ int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) 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; } -- 1.9.1