소스 검색

[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>
Knobloch, Thomas 18 년 전
부모
커밋
78ab67da10
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      drivers/mtd/nand/nand_base.c

+ 1 - 1
drivers/mtd/nand/nand_base.c

@@ -312,7 +312,7 @@ static int nand_block_bad(struct mtd_info *mtd, loff_t ofs, int getchip)
 		/* Select the NAND device */
 		chip->select_chip(mtd, chipnr);
 	} else
-		page = (int)ofs;
+		page = (int)(ofs >> chip->page_shift);
 
 	if (chip->options & NAND_BUSWIDTH_16) {
 		chip->cmdfunc(mtd, NAND_CMD_READOOB, chip->badblockpos & 0xFE,