[PATCH 1/2] nand_write: initialize OOB buffer for each page

Jan Luebbe jlu at pengutronix.de
Tue Jan 29 04:58:01 EST 2013


Previously, during a multi-page write, chip->oob_poi would not be
reinitialized.

Signed-off-by: Jan Luebbe <jlu at pengutronix.de>
---
 drivers/mtd/nand/nand_write.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/nand_write.c b/drivers/mtd/nand/nand_write.c
index 9997127..f4f2fed 100644
--- a/drivers/mtd/nand/nand_write.c
+++ b/drivers/mtd/nand/nand_write.c
@@ -296,15 +296,15 @@ int nand_do_write_ops(struct mtd_info *mtd, loff_t to,
 	    (chip->pagebuf << chip->page_shift) < (to + ops->len))
 		chip->pagebuf = -1;
 
-	/* Initialize to all 0xFF, to avoid the possibility of
-	   left over OOB data from a previous OOB read. */
-	memset(chip->oob_poi, 0xff, mtd->oobsize);
-
 	while(1) {
 		int bytes = mtd->writesize;
 		int cached = writelen > bytes && page != blockmask;
 		uint8_t *wbuf = buf;
 
+		/* Initialize to all 0xFF, to avoid the possibility of
+		   left over OOB data from a previous OOB read or write. */
+		memset(chip->oob_poi, 0xff, mtd->oobsize);
+
 		/* Partial page write ? */
 		if (unlikely(column || writelen < (mtd->writesize - 1))) {
 			cached = 0;
-- 
1.7.10.4




More information about the barebox mailing list