From: Liu, Wentao <wentao.liu@intel.com>
Date: Tue, 17 Jan 2012 19:55:02 +0000 (+0000)
Subject: nand_util: correct YAFFS image write function
X-Git-Tag: v2025.01-rc5-pxa1908~17674^2~140^2~4
X-Git-Url: http://git.dujemihanovic.xyz/html/index.html?a=commitdiff_plain;h=65683026a5eb07d6186dc02b33b1e5874dbb6591;p=u-boot.git

nand_util: correct YAFFS image write function

In function nand_write_skip_bad(),for YAFFS filesystem part,
write_oob() will return 0 when success, so when rval equals 0,
it should continue to write the next page, and no break.

Signed-off-by: Wentao, Liu <wentao.liu@intel.com>
Acked-by: Lei Wen <leiwen@marvell.com>
Signed-off-by: Scott Wood <scott@tyr.buserror.net>
---

diff --git a/drivers/mtd/nand/nand_util.c b/drivers/mtd/nand/nand_util.c
index 60c778e637..7ed8b1891c 100644
--- a/drivers/mtd/nand/nand_util.c
+++ b/drivers/mtd/nand/nand_util.c
@@ -564,7 +564,7 @@ int nand_write_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
 				ops.oobbuf = ops.datbuf + pagesize;
 
 				rval = nand->write_oob(nand, offset, &ops);
-				if (!rval)
+				if (rval != 0)
 					break;
 
 				offset += pagesize;