From 4a76b492c7b5b8d4c3d291de782c712f8bd8c79f Mon Sep 17 00:00:00 2001 From: Kyungmin Park Date: Mon, 3 Aug 2009 13:38:23 +0900 Subject: [PATCH] OneNAND: Fix wrong ORing at runtime badblock check Signed-off-by: Kyungmin Park --- drivers/mtd/onenand/onenand_bbt.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/onenand/onenand_bbt.c b/drivers/mtd/onenand/onenand_bbt.c index 8bc9e8a..a8b45e0 100644 --- a/drivers/mtd/onenand/onenand_bbt.c +++ b/drivers/mtd/onenand/onenand_bbt.c @@ -68,13 +68,14 @@ static int read_page_oob(struct mtd_info *mtd, loff_t from, u_char *buf) /* Set as normal block */ res = 0x00; - bbm->bbt[block >> 3] |= 0x00 << (block & 0x6); + bbm->bbt[block >> 3] &= ~(0x3 << (block & 0x6)); + bbm->bbt[block >> 3] |= res << (block & 0x6); for (j = 0; j < 2; j++) { ret = onenand_bbt_read_oob(mtd, from + j * mtd->writesize + bd->offs, &ops); if (ret || check_short_pattern(&buf[j * scanlen], scanlen, mtd->writesize, bd)) { - bbm->bbt[block >> 3] |= 0x03 << (block & 0x6); res = 0x03; + bbm->bbt[block >> 3] |= res << (block & 0x6); printk(KERN_WARNING "Bad eraseblock %d at 0x%08x\n", block >> 1, (unsigned int) from); mtd->ecc_stats.badblocks++; @@ -82,7 +83,7 @@ static int read_page_oob(struct mtd_info *mtd, loff_t from, u_char *buf) } } - return ret; + return res; } /** -- 2.7.4