mtd: docg4: ecc.read_page() returns 0 on uncorrectable errors
authorMike Dunn <mikedunn@newsguy.com>
Tue, 11 Sep 2012 15:50:50 +0000 (08:50 -0700)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 29 Sep 2012 14:54:11 +0000 (15:54 +0100)
Currently the docg4's ecc.read_page() method returns -EBADMSG when
uncorrectable bitflips occur.  This is wrong; 0 should be returned in
this case.  An error code should only be returned by this method in the
case of a hardware error (probably -EIO).

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/nand/docg4.c

index 793921e56f8e27c08e52e329f27b34be0df3e60a..799da5d1c85737671d7ab0039b1e022e8c9bbf40 100644 (file)
@@ -776,6 +776,8 @@ static int read_page(struct mtd_info *mtd, struct nand_chip *nand,
        }
 
        writew(0, docptr + DOC_DATAEND);
+       if (bits_corrected == -EBADMSG)   /* uncorrectable errors */
+               return 0;
        return bits_corrected;
 }