upgrade to linux 2.6.10-1.12_FC2
[linux-2.6.git] / drivers / mtd / mtdchar.c
index 3db73d8..fafae6e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: mtdchar.c,v 1.64 2004/08/09 13:59:46 dwmw2 Exp $
+ * $Id: mtdchar.c,v 1.65 2004/09/23 23:45:47 gleixner Exp $
  *
  * Character-device access to raw MTD devices.
  *
@@ -179,7 +179,13 @@ static ssize_t mtd_read(struct file *file, char __user *buf, size_t count,loff_t
                        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 @@ static ssize_t mtd_read(struct file *file, char __user *buf, size_t count,loff_t
                
                kfree(kbuf);
        }
-       
+
        return total_retlen;
 } /* mtd_read */