[PATCH 5/6] mtd: nand-bb: Fix test for bad block when reading

Sascha Hauer s.hauer at pengutronix.de
Tue Feb 10 01:03:33 PST 2015


in nand_bb_read() 'offset' contains the virtual position on the device,
but we have to test for a bad block on the raw physical position, so
use bb->offset instead of offset

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/mtd/nand/nand-bb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand-bb.c b/drivers/mtd/nand/nand-bb.c
index f134635..c8f6988 100644
--- a/drivers/mtd/nand/nand-bb.c
+++ b/drivers/mtd/nand/nand-bb.c
@@ -62,7 +62,7 @@ static ssize_t nand_bb_read(struct cdev *cdev, void *buf, size_t count,
 		if (max <= 0)
 			break;
 
-		if (mtd_block_isbad(bb->mtd, offset)) {
+		if (mtd_block_isbad(bb->mtd, bb->offset)) {
 			printf("skipping bad block at 0x%08llx\n", bb->offset);
 			bb->offset += bb->mtd->erasesize;
 			continue;
-- 
2.1.4




More information about the barebox mailing list