nand: fixed failed reads on corrected ECC errors in nand_util.c
authorValeriy Glushkov <gvv@lstec.com>
Tue, 14 Jul 2009 10:51:10 +0000 (13:51 +0300)
committerScott Wood <scottwood@freescale.com>
Thu, 16 Jul 2009 22:52:01 +0000 (17:52 -0500)
Signed-off-by: Valeriy Glushkov <gvv@lstec.com>
Signed-off-by: Paulraj, Sandeep <s-paulraj@ti.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
drivers/mtd/nand/nand_util.c

index fc16282c2e1c9d6f127b83c70efd28ea22576889..694ead68a16d90c9370b882e01b35b904254e226 100644 (file)
@@ -567,10 +567,10 @@ int nand_read_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
 
        if (len_incl_bad == *length) {
                rval = nand_read (nand, offset, length, buffer);
-               if (rval != 0)
-                       printf ("NAND read from offset %llx failed %d\n",
-                               offset, rval);
-
+               if (!rval || rval == -EUCLEAN)
+                       return 0;
+               printf ("NAND read from offset %llx failed %d\n",
+                       offset, rval);
                return rval;
        }
 
@@ -591,7 +591,7 @@ int nand_read_skip_bad(nand_info_t *nand, loff_t offset, size_t *length,
                        read_length = nand->erasesize - block_offset;
 
                rval = nand_read (nand, offset, &read_length, p_buffer);
-               if (rval != 0) {
+               if (rval && rval != -EUCLEAN) {
                        printf ("NAND read from offset %llx failed %d\n",
                                offset, rval);
                        *length -= left_to_read;