mtd/drivers/mtd mtdchar.c,1.64,1.65

gleixner at infradead.org gleixner at infradead.org
Thu Sep 23 19:45:50 EDT 2004


Update of /home/cvs/mtd/drivers/mtd
In directory phoenix.infradead.org:/tmp/cvs-serv20077

Modified Files:
	mtdchar.c 
Log Message:
return the buffer despite ECC errors on NAND. This is sane, as the driver returns the real data and the return value is for information of NAND aware filesystems. Userspace access to raw NAND is usually restricted to debugging tools which are aware of the NAND specific problems. For the records: dwmw2 accepted by saying "ok the read thing".

Index: mtdchar.c
===================================================================
RCS file: /home/cvs/mtd/drivers/mtd/mtdchar.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -r1.64 -r1.65
--- mtdchar.c	9 Aug 2004 13:59:46 -0000	1.64
+++ mtdchar.c	23 Sep 2004 23:45:47 -0000	1.65
@@ -179,7 +179,13 @@
 			return -ENOMEM;
 		
 		ret = MTD_READ(mtd, *ppos, len, &retlen, kbuf);
-		if (!ret) {
+		/* Nand returns -EBADMSG on ecc errors, but it returns
+		 * the data. For our userspace tools it is important
+		 * to dump areas with ecc errors ! 
+		 * Userspace software which accesses NAND this way
+		 * must be aware of the fact that it deals with NAND
+		 */
+		if (!ret || (ret == -EBADMSG)) {
 			*ppos += retlen;
 			if (copy_to_user(buf, kbuf, retlen)) {
 			        kfree(kbuf);
@@ -198,7 +204,7 @@
 		
 		kfree(kbuf);
 	}
-	
+
 	return total_retlen;
 } /* mtd_read */
 





More information about the linux-mtd-cvs mailing list