]> git.baikalelectronics.ru Git - uboot.git/commit
mtd: nand: Fix nand write error with bad block addresses above 32-bit
authorT Karthik Reddy <t.karthik.reddy@xilinx.com>
Mon, 31 Aug 2020 12:27:37 +0000 (14:27 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 11 Sep 2020 21:13:56 +0000 (17:13 -0400)
commit0e4f2469c5af7a185463089cd2cb4f962fc33991
tree35d09c59d365123c5e8072c33c0ee19e45dd2a28
parent2c0710b58ca5d63ee087ee4f1b53e4613903f522
mtd: nand: Fix nand write error with bad block addresses above 32-bit

Nand writes should skip the bad blocks with "nand write" command.
In case of bad blocks with above 32-bit address, nand_block_isbad()
returns false due to truncated bad block address.

In below code segment,

if (nand_block_isbad(mtd, offset & ~(mtd->erasesize - 1)))

offset is 64-bit and mtd->erasesize is 32-bit, hence the truncation is
happening. Cast 'mtd->erasesize' with loff_t to fix this issue.

Signed-off-by: T Karthik Reddy <t.karthik.reddy@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/mtd/nand/raw/nand_util.c