summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicard Wanderlof2015-11-13 14:17:28 +0100
committerKevin Wolf2015-11-25 14:27:43 +0100
commit8e37ca6d0be8aae2887c167da783fd2d9536c962 (patch)
treef27acfd9275a1ce3e0efd892b312f9d0f3609824
parenttest-aio: Fix event notifier cleanup (diff)
downloadqemu-8e37ca6d0be8aae2887c167da783fd2d9536c962.tar.gz
qemu-8e37ca6d0be8aae2887c167da783fd2d9536c962.tar.xz
qemu-8e37ca6d0be8aae2887c167da783fd2d9536c962.zip
nand: fix flash erase when oob is in memory
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 <ricardw@axis.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r--hw/block/nand.c2
1 files changed, 1 insertions, 1 deletions
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);