diff options
author | Abhishek Sahu <absahu@codeaurora.org> | 2018-06-13 14:32:36 +0530 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@bootlin.com> | 2018-06-22 00:15:45 +0200 |
commit | e9893e6fa932f42c90c4ac5849fa9aa0f0f00a34 (patch) | |
tree | 73ad7d8d31b23a5f71ebb04e641f25bc086dd30e | |
parent | 3f77f244d8ec28e3a0a81240ffac7d626390060c (diff) | |
download | op-kernel-dev-e9893e6fa932f42c90c4ac5849fa9aa0f0f00a34.zip op-kernel-dev-e9893e6fa932f42c90c4ac5849fa9aa0f0f00a34.tar.gz |
mtd: rawnand: fix return value check for bad block status
Positive return value from read_oob() is making false BAD
blocks. For some of the NAND controllers, OOB bytes will be
protected with ECC and read_oob() will return number of bitflips.
If there is any bitflip in ECC protected OOB bytes for BAD block
status page, then that block is getting treated as BAD.
Fixes: c120e75e0e7d ("mtd: nand: use read_oob() instead of cmdfunc() for bad block check")
Cc: <stable@vger.kernel.org>
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
-rw-r--r-- | drivers/mtd/nand/raw/nand_base.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index 10c4f991..b01d15e 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -440,7 +440,7 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs) for (; page < page_end; page++) { res = chip->ecc.read_oob(mtd, chip, page); - if (res) + if (res < 0) return res; bad = chip->oob_poi[chip->badblockpos]; |