mtd/util nandwrite.c,1.16,1.17

gleixner at infradead.org gleixner at infradead.org
Sun Oct 24 10:57:24 EDT 2004


Update of /home/cvs/mtd/util
In directory phoenix.infradead.org:/tmp/cvs-serv24704

Modified Files:
	nandwrite.c 
Log Message:
Make sure to check each block. The check was not done for consecutive bad blocks. Provided by Philippe De Swert <philippedeswert at pi.be>

Index: nandwrite.c
===================================================================
RCS file: /home/cvs/mtd/util/nandwrite.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- nandwrite.c	24 Sep 2004 13:37:28 -0000	1.16
+++ nandwrite.c	24 Oct 2004 14:57:20 -0000	1.17
@@ -313,7 +313,12 @@
 	/* Get data from input and write to the device */
 	while (imglen && (mtdoffset < meminfo.size)) {
 		// new eraseblock , check for bad block(s)
-		if (blockstart != (mtdoffset & (~meminfo.erasesize + 1))) {
+		// Stay in the loop to be sure if the mtdoffset changes because
+		// of a bad block, that the next block that will be written to
+		// is also checked. Thus avoiding errors if the block(s) after the 
+		// skipped block(s) is also bad (number of blocks depending on 
+		// the blockalign
+		while (blockstart != (mtdoffset & (~meminfo.erasesize + 1))) {
 			blockstart = mtdoffset & (~meminfo.erasesize + 1);
 			offs = blockstart;
 		        baderaseblock = 0;





More information about the linux-mtd-cvs mailing list