[PATCH] mtd: nand: fix return code for uncorrectable error

Hauke Mehrtens hauke at hauke-m.de
Sun Sep 14 14:45:02 PDT 2014


nand_correct_data() should return -EBADMSG when it finds an
uncorrectable error and not just -1.

This is based on OpenWrt patch:
https://dev.openwrt.org/browser/trunk/target/linux/generic/patches-3.10/451-mtd-nand-fix-return-code-of-nand_correct_data-function.patcht

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 drivers/mtd/nand/nand_ecc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/nand_ecc.c b/drivers/mtd/nand/nand_ecc.c
index 97c4c02..244a634 100644
--- a/drivers/mtd/nand/nand_ecc.c
+++ b/drivers/mtd/nand/nand_ecc.c
@@ -507,7 +507,7 @@ int __nand_correct_data(unsigned char *buf,
 		return 1;	/* error in ECC data; no action needed */
 
 	pr_err("%s: uncorrectable ECC error\n", __func__);
-	return -1;
+	return -EBADMSG;
 }
 EXPORT_SYMBOL(__nand_correct_data);
 
-- 
1.9.1




More information about the linux-mtd mailing list