mtd: nand: return consistent error codes in ecc.correct() implementations
The error code returned by the ecc.correct() are not consistent over the all implementations. Document the expected behavior in include/linux/mtd/nand.h and fix offending implementations. [Brian: this looks like a bugfix for the ECC reporting in the bf5xx_nand driver, but we haven't seen any testing results for it] Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Tested-by: Franklin S Cooper Jr. <fcooper@ti.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
This commit is contained in:

committed by
Brian Norris

parent
6f357de854
commit
6e9411923b
@@ -207,7 +207,7 @@ static int nand_davinci_correct_1bit(struct mtd_info *mtd, u_char *dat,
|
||||
dat[diff >> (12 + 3)] ^= BIT((diff >> 12) & 7);
|
||||
return 1;
|
||||
} else {
|
||||
return -1;
|
||||
return -EBADMSG;
|
||||
}
|
||||
} else if (!(diff & (diff - 1))) {
|
||||
/* Single bit ECC error in the ECC itself,
|
||||
@@ -215,7 +215,7 @@ static int nand_davinci_correct_1bit(struct mtd_info *mtd, u_char *dat,
|
||||
return 1;
|
||||
} else {
|
||||
/* Uncorrectable error */
|
||||
return -1;
|
||||
return -EBADMSG;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -391,7 +391,7 @@ compare:
|
||||
return 0;
|
||||
case 1: /* five or more errors detected */
|
||||
davinci_nand_readl(info, NAND_ERR_ERRVAL1_OFFSET);
|
||||
return -EIO;
|
||||
return -EBADMSG;
|
||||
case 2: /* error addresses computed */
|
||||
case 3:
|
||||
num_errors = 1 + ((fsr >> 16) & 0x03);
|
||||
|
Reference in New Issue
Block a user