Patchwork [U-Boot] mtd: nand: fix the partial page write condition

login
register
mail settings
Submitter htbegin
Date March 2, 2013, 8:59 a.m.
Message ID <1362214767-7052-1-git-send-email-hotforest@gmail.com>
Download mbox | patch
Permalink /patch/224474/
State Accepted
Delegated to: Scott Wood
Headers show

Comments

htbegin - March 2, 2013, 8:59 a.m.
When writelen is mtd->writesize - 1, it is still a partial page write

Signed-off-by: Tao Hou <hotforest@gmail.com>
Cc: Scott Wood <scottwood@freescale.com>
---
 drivers/mtd/nand/nand_base.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Scott Wood - May 22, 2013, 9:44 p.m.
On Fri, Mar 01, 2013 at 10:59:27PM -0000, htbegin wrote:
> When writelen is mtd->writesize - 1, it is still a partial page write
> 
> Signed-off-by: Tao Hou <hotforest@gmail.com>
> Cc: Scott Wood <scottwood@freescale.com>
> 
> ---
> drivers/mtd/nand/nand_base.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to u-boot-nand-flash

-Scott

Patch

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;