aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorKnobloch, Thomas <knobloch@siemens.com>2007-04-27 07:19:36 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2007-04-27 10:13:53 -0400
commit78ab67da1002d954ea4c3e2b441e2483c41f94e8 (patch)
treeea967c51ff6d1b126f3db8ff7c73dfaa63875091 /drivers/mtd
parentef2e58ea6b9931c3a4816c66593da49bb20e3b24 (diff)
[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>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/nand_base.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index ab3b2d16cffe..04de315e4937 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -312,7 +312,7 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
312 /* Select the NAND device */ 312 /* Select the NAND device */
313 chip->select_chip(mtd, chipnr); 313 chip->select_chip(mtd, chipnr);
314 } else 314 } else
315 page = (int)ofs; 315 page = (int)(ofs >> chip->page_shift);
316 316
317 if (chip->options & NAND_BUSWIDTH_16) { 317 if (chip->options & NAND_BUSWIDTH_16) {
318 chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos & 0xFE, 318 chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos & 0xFE,