Re: [PATCH] mtd: nand_bbt: Skip bad blocks when searching for the BBT in NAND

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Please skip this patch, there seems to be a problem here.

Regards

Y. Bas

Am 04.05.20 um 15:44 schrieb Yunus Bas:
From: Stefan Riedmueller <s.riedmueller@xxxxxxxxx>

The blocks containing the bad block table can become bad as well. So
make sure to skip any blocks that are marked bad when searching for the
bad block table.

Signed-off-by: Stefan Riedmueller <s.riedmueller@xxxxxxxxx>
Signed-off-by: Christian Hemp <c.hemp@xxxxxxxxx>
Signed-off-by: Yunus Bas <y.bas@xxxxxxxxx>
---
  drivers/mtd/nand/nand_bbt.c | 10 ++++++++--
  1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 435a06f..403c0ae 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -560,8 +560,14 @@ static int search_bbt(struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
  			int actblock = startblock + dir * block;
  			loff_t offs = (loff_t)actblock << this->bbt_erase_shift;
- /* Read first page */
-			scan_read(mtd, buf, offs, mtd->writesize, td);
+			/* Read first page including oob */
+			scan_read_oob(mtd, buf, offs, scanlen);
+
+			/* Skip blocks which are marked bad */
+			if (buf[mtd->writesize] == 0x00) {
+				continue;
+			}
+
  			if (!check_pattern(buf, scanlen, mtd->writesize, td)) {
  				td->pages[i] = actblock << blocktopage;
  				if (td->options & NAND_BBT_VERSION) {

_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux