Commit 78ab67da1002d954ea4c3e2b441e2483c41f94e8

Authored by Knobloch, Thomas
Committed by David Woodhouse
1 parent ef2e58ea6b

[MTD] [NAND] Wrong calculation of page number in nand_block_bad()

In case that there is no memory based bad block table available the
function nand_block_checkbad() in drivers/mtd/nand/nand_base.c will call
nand_block_bad() directly. When parameter 'getchip' is set to zero,
nand_block_bad() will not right shift the offset to calculate the
correct page number.

Signed-off-by: Thomas Knobloch <knobloch@siemens.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>

Showing 1 changed file with 1 additions and 1 deletions Side-by-side Diff

drivers/mtd/nand/nand_base.c
... ... @@ -312,7 +312,7 @@
312 312 /* Select the NAND device */
313 313 chip->select_chip(mtd, chipnr);
314 314 } else
315   - page = (int)ofs;
  315 + page = (int)(ofs >> chip->page_shift);
316 316  
317 317 if (chip->options & NAND_BUSWIDTH_16) {
318 318 chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos & 0xFE,