From 8e37ca6d0be8aae2887c167da783fd2d9536c962 Mon Sep 17 00:00:00 2001 From: Ricard Wanderlof Date: Fri, 13 Nov 2015 14:17:28 +0100 Subject: nand: fix flash erase when oob is in memory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit For the "main area on file, oob in memory" case, fix the shifts so that we erase the correct number of pages. Signed-off-by: Ricard Wanderlöf Signed-off-by: Kevin Wolf --- hw/block/nand.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'hw') diff --git a/hw/block/nand.c b/hw/block/nand.c index a68266f887..f0e34139fe 100644 --- a/hw/block/nand.c +++ b/hw/block/nand.c @@ -712,7 +712,7 @@ static void glue(nand_blk_erase_, PAGE_SIZE)(NANDFlashState *s) memset(s->storage + (PAGE(addr) << OOB_SHIFT), 0xff, OOB_SIZE << s->erase_shift); i = SECTOR(addr); - page = SECTOR(addr + (ADDR_SHIFT + s->erase_shift)); + page = SECTOR(addr + (1 << (ADDR_SHIFT + s->erase_shift))); for (; i < page; i ++) if (blk_write(s->blk, i, iobuf, 1) < 0) { printf("%s: write error in sector %" PRIu64 "\n", __func__, i); -- cgit v1.2.3