From: Mike Dunn Date: Tue, 11 Sep 2012 15:50:50 +0000 (-0700) Subject: mtd: docg4: ecc.read_page() returns 0 on uncorrectable errors X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5bf3d66a933efb71fa6db08a5043a617b6eadb4a;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git mtd: docg4: ecc.read_page() returns 0 on uncorrectable errors 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 Acked-by: Brian Norris Signed-off-by: Artem Bityutskiy Signed-off-by: David Woodhouse --- diff --git a/drivers/mtd/nand/docg4.c b/drivers/mtd/nand/docg4.c index 793921e56f8e..799da5d1c857 100644 --- a/drivers/mtd/nand/docg4.c +++ b/drivers/mtd/nand/docg4.c @@ -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; }