From patchwork Sat Mar 2 08:59:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hou Tao X-Patchwork-Id: 224474 X-Patchwork-Delegate: scottwood@freescale.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 8154E2C02C1 for ; Sat, 2 Mar 2013 19:58:48 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 500184A0F7; Sat, 2 Mar 2013 09:58:46 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sKOX+HT6xxgy; Sat, 2 Mar 2013 09:58:46 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 87EB44A0C7; Sat, 2 Mar 2013 09:58:43 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7D1E44A0C7 for ; Sat, 2 Mar 2013 09:58:41 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hElTiBV3nlJU for ; Sat, 2 Mar 2013 09:58:39 +0100 (CET) X-Greylist: delayed 323 seconds by postgrey-1.27 at theia; Sat, 02 Mar 2013 09:58:37 CET X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pa0-f52.google.com (mail-pa0-f52.google.com [209.85.220.52]) by theia.denx.de (Postfix) with ESMTPS id 3CA7B4A0C5 for ; Sat, 2 Mar 2013 09:58:37 +0100 (CET) Received: by mail-pa0-f52.google.com with SMTP id fb1so2268369pad.25 for ; Sat, 02 Mar 2013 00:58:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=7VAb4OaTpdJqQNoI15JwOd7xQ22ZubP4FwTZYP0dhHo=; b=liXeoqB28Zn0X5Wqx5P20F5CVPVZSWgHayg0iYJBhHeyI+UiLHZ2wLC/SGHXb3EKJ9 f2M84EmYbUXYqJ70GiW5Kdd6ahN5LnH6vMPZ4DUARLGutPbAgYGWZCmyZvc3cHptOM6f HRaVJuir/m+vOdm2lHuVkKmRL9KPG1y7UH44vFQs7MiG8qK7/v9d2hCWCHqKp/7uhgAV 3xvLhmv74a3kRfkLgS6O3sHN63a4YXVzLYAV0fDXc8YVu+YRt6VP89JBGTw57y8HJEBI mRvLkC7jeiympxI4JAhjahMDrKM1fgbXiIS6z3EXbI2pA3DQpLmxXzaAP/dHS2h6wdmR humg== X-Received: by 10.66.7.196 with SMTP id l4mr22128810paa.81.1362214392318; Sat, 02 Mar 2013 00:53:12 -0800 (PST) Received: from localhost.localdomain ([115.199.193.213]) by mx.google.com with ESMTPS id pn9sm14941112pbb.22.2013.03.02.00.53.07 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 02 Mar 2013 00:53:11 -0800 (PST) From: Tao Hou To: u-boot@lists.denx.de Date: Sat, 2 Mar 2013 16:59:27 +0800 Message-Id: <1362214767-7052-1-git-send-email-hotforest@gmail.com> X-Mailer: git-send-email 1.7.9.5 Cc: Scott Wood , Tao Hou Subject: [U-Boot] [PATCH] mtd: nand: fix the partial page write condition X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de When writelen is mtd->writesize - 1, it is still a partial page write Signed-off-by: Tao Hou Cc: Scott Wood --- drivers/mtd/nand/nand_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index a2d06be..3d84659 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c @@ -1973,7 +1973,7 @@ static int nand_do_write_ops(struct mtd_info *mtd, loff_t to, uint8_t *wbuf = buf; /* Partial page write ? */ - if (unlikely(column || writelen < (mtd->writesize - 1))) { + if (unlikely(column || writelen < mtd->writesize)) { cached = 0; bytes = min_t(int, bytes - column, (int) writelen); chip->pagebuf = -1;