mtd_dataflash, fix block vs page erase
PATCH 1/1 mtd_dataflash, fix block vs page erase
The "<=" should be ">=", but it wouldn't matter with JFFS2.
Fix a bug in the block-erase optimization for Dataflash; it was using block erase even for smaller segments that need page erase.
That wouldn't matter for JFFS2, which never erases less than one block (sometimes several blocks), but for other callers it might.
Signed-off-by David Brownell <[email protected]>
drivers/mtd/devices/mtd_dataflash.c +1 -1
@@ -178,7 +178,7 @@ static int dataflash_erase(struct mtd_in* we're at a block boundary and need to erase the whole block. */ pageaddr = instr->addr / priv->page_size; - do_block = (pageaddr &0x7 ) ==0 && instr->len <= blocksize; + do_block = (pageaddr &0x7 ) ==0 && instr->len >= blocksize; pageaddr = pageaddr << priv->page_offset; command[0 ] = do_block ?OP_ERASE_BLOCK :OP_ERASE_PAGE ;