Skip to contentSkip to conversation

mtd: nand: fix return value check for bad block status

PATCH In review Abhishek Sahu 2 participants 3 messages Jul 3, 2018 – Jul 5, 2018

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtd: nand: fix return value check for bad block status

commit e9893e6fa932f42c90c4ac5849fa9aa0f0f00a34 upstream.

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")
[backported to 4.14.y]

---

This is backported patch for failed patch mentioned in
https://www.spinics.net/lists/stable/msg245833.html
The failure happened due to file rename.

 drivers/mtd/nand/nand_base.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/nand/nand_base.c +1 -1
index 528e04f..d410de3 100644
@@ -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];
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc.
is a member of Code Aurora Forum, hosted by The Linux Foundation
maintainer
#1 lore raw
Quoted 1 line · Abhishek Sahu

commit e9893e6fa932f42c90c4ac5849fa9aa0f0f00a34 upstream.

No it is not :(

Please fix up and resend.

greg k-h

maintainer
#2 lore raw
Quoted 6 lines · Greg KH
Quoted 1 line · Abhishek Sahu

commit e9893e6fa932f42c90c4ac5849fa9aa0f0f00a34 upstream.

No it is not :(

Please fix up and resend.

Ugh, my fault, nevermind, now queued up.

greg k-h

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/