From patchwork Wed May 13 12:12:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Korsgaard X-Patchwork-Id: 27153 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id DDD23B7069 for ; Wed, 13 May 2009 22:14:43 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1M4DJr-0001zb-AX; Wed, 13 May 2009 12:12:19 +0000 Received: from mail-ew0-f177.google.com ([209.85.219.177]) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1M4DJh-0001yA-3Q for linux-mtd@lists.infradead.org; Wed, 13 May 2009 12:12:16 +0000 Received: by ewy25 with SMTP id 25so1174871ewy.18 for ; Wed, 13 May 2009 05:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:received:from:to:cc :subject:date:message-id:x-mailer; bh=Y7HCBuget0yXlzGLFzo0SO4DlhYZbS58+ePiOQtroY8=; b=VrDpjNMIVgDeEfnc+P8ko+/Ry2JhZSnxYgMqavMpegUf73ruv3SFf9e/eebi6D1Bhv gBuNd90dCYryhzSYNB99WJ9K17lSI5CD3tYTR4Y82o6Q4AShQi81cPE2s/GoPyffYDvy LrmVBDJkE4CGoH6gf68i9pk5BS+rBRBlb3kCs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:to:cc:subject:date:message-id:x-mailer; b=LuBSBxm+Q7FxraJJfSZIRonxlHiJS1dZWVKnZmS6gkI/t0bFDBACcb7OhqF+j/T+Lb pKekKoEYlAsW4x8QGbmklafEBqsRPKnanBBfjsRI28GRRYwkpTEr34+9luwNUkGQfXtK /KQYjbmksIvMrR1Kg/QUou1qZuUoGS8GyVnMI= Received: by 10.210.36.8 with SMTP id j8mr261531ebj.36.1242216724331; Wed, 13 May 2009 05:12:04 -0700 (PDT) Received: from macbook.be.48ers.dk (191.207-78-194.adsl-fix.skynet.be [194.78.207.191]) by mx.google.com with ESMTPS id 7sm2430534eyb.55.2009.05.13.05.12.03 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 13 May 2009 05:12:03 -0700 (PDT) Received: by macbook.be.48ers.dk (Postfix, from userid 1000) id 726F0C3A1B; Wed, 13 May 2009 14:12:02 +0200 (CEST) From: Peter Korsgaard To: Artem.Bityutskiy@nokia.com, David.Woodhouse@intel.com, linux-mtd@lists.infradead.org Subject: [PATCH] mtd_dataflash: unbreak erase support Date: Wed, 13 May 2009 14:12:02 +0200 Message-Id: <1242216722-7262-1-git-send-email-jacmet@sunsite.dk> X-Mailer: git-send-email 1.6.2 X-Spam-Score: 0.0 (/) Cc: stable@kernel.org X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Commit 5b7f3a50 (fix dataflash 64-bit divisions) unfortunately introduced a typo. Erase addr and len were swapped in the pageaddr calculation, causing the wrong sectors to get erased. Please consider for 2.6.29-stable as well. Signed-off-by: Peter Korsgaard Acked-by: Artem Bityutskiy --- drivers/mtd/devices/mtd_dataflash.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/mtd/devices/mtd_dataflash.c b/drivers/mtd/devices/mtd_dataflash.c index 62dee54..43976aa 100644 --- a/drivers/mtd/devices/mtd_dataflash.c +++ b/drivers/mtd/devices/mtd_dataflash.c @@ -178,7 +178,7 @@ static int dataflash_erase(struct mtd_info *mtd, struct erase_info *instr) /* Calculate flash page address; use block erase (for speed) if * we're at a block boundary and need to erase the whole block. */ - pageaddr = div_u64(instr->len, priv->page_size); + pageaddr = div_u64(instr->addr, priv->page_size); do_block = (pageaddr & 0x7) == 0 && instr->len >= blocksize; pageaddr = pageaddr << priv->page_offset;