From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a16Kl-00038k-En for qemu-devel@nongnu.org; Tue, 24 Nov 2015 00:40:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a16Kk-0004uU-NO for qemu-devel@nongnu.org; Tue, 24 Nov 2015 00:40:07 -0500 Date: Tue, 24 Nov 2015 06:39:58 +0100 From: Rabin Vincent Message-ID: <20151124053958.GA31927@axis.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] nand: fix flash erase when oob is in memory List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ricard =?iso-8859-1?Q?Wanderl=F6f?= , kwolf@redhat.com Cc: QEMU development , qemu-block@nongnu.org (to: Kevin and cc: qemu-block) On Fri, Nov 13, 2015 at 02:17:28PM +0100, Ricard Wanderl=F6f wrote: >=20 > For the "main area on file, oob in memory" case, fix the shifts so that > we erase the correct number of pages. >=20 > Signed-off-by: Ricard Wanderl=F6f > --- > hw/block/nand.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/hw/block/nand.c b/hw/block/nand.c > index a68266f..f0e3413 100644 > --- a/hw/block/nand.c > +++ b/hw/block/nand.c > @@ -712,7 +712,7 @@ static void glue(nand_blk_erase_, PAGE_SIZE)(NANDFl= ashState *s) > memset(s->storage + (PAGE(addr) << OOB_SHIFT), > 0xff, OOB_SIZE << s->erase_shift); > i =3D SECTOR(addr); > - page =3D SECTOR(addr + (ADDR_SHIFT + s->erase_shift)); > + page =3D 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", __fu= nc__, i); > --=20 > 1.7.10.4 >=20 > --=20 > Ricard Wolf Wanderl=F6f ricardw(at)axis.com > Axis Communications AB, Lund, Sweden www.axis.com > Phone +46 46 272 2016 Fax +46 46 13 61 30 >=20 >=20