[PATCH] UBI: fastmap: correct error check

Brian Norris computersforpeace at gmail.com
Tue May 20 22:35:38 PDT 2014


The return value from ubi_io_read_ec_hdr() was stored in 'err', not in
'ret'.

This issue was reported by Coverity Scan.

Signed-off-by: Brian Norris <computersforpeace at gmail.com>
Cc: Richard Weinberger <richard at nod.at>
---
 drivers/mtd/ubi/fastmap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index c5dad652614d..6de0e10fcea3 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -423,7 +423,7 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai,
 				pnum, err);
 			ret = err > 0 ? UBI_BAD_FASTMAP : err;
 			goto out;
-		} else if (ret == UBI_IO_BITFLIPS)
+		} else if (err == UBI_IO_BITFLIPS)
 			scrub = 1;
 
 		/*
-- 
1.7.9.5




More information about the linux-mtd mailing list