Commit 6c1207b5 authored by Harvey Hunt's avatar Harvey Hunt Committed by Brian Norris

mtd: nand: jz4780: Update ecc correction error codes

Update jz4780_bch_ecc_correct's return codes with appropriate values,
as specified in /include/linux/mtd/nand.h.
Signed-off-by: default avatarHarvey Hunt <harvey.hunt@imgtec.com>
Cc: Alex Smith <alex@alex-smith.me.uk>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: linux-kernel@vger.kernel.org
Reviewed-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent c66b651c
...@@ -210,8 +210,8 @@ EXPORT_SYMBOL(jz4780_bch_calculate); ...@@ -210,8 +210,8 @@ EXPORT_SYMBOL(jz4780_bch_calculate);
* Given the raw data and the ECC read from the NAND device, detects and * Given the raw data and the ECC read from the NAND device, detects and
* corrects errors in the data. * corrects errors in the data.
* *
* Return: the number of bit errors corrected, or -1 if there are too many * Return: the number of bit errors corrected, -EBADMSG if there are too many
* errors to correct or we timed out waiting for the controller. * errors to correct or -ETIMEDOUT if we timed out waiting for the controller.
*/ */
int jz4780_bch_correct(struct jz4780_bch *bch, struct jz4780_bch_params *params, int jz4780_bch_correct(struct jz4780_bch *bch, struct jz4780_bch_params *params,
u8 *buf, u8 *ecc_code) u8 *buf, u8 *ecc_code)
...@@ -227,13 +227,13 @@ int jz4780_bch_correct(struct jz4780_bch *bch, struct jz4780_bch_params *params, ...@@ -227,13 +227,13 @@ int jz4780_bch_correct(struct jz4780_bch *bch, struct jz4780_bch_params *params,
if (!jz4780_bch_wait_complete(bch, BCH_BHINT_DECF, &reg)) { if (!jz4780_bch_wait_complete(bch, BCH_BHINT_DECF, &reg)) {
dev_err(bch->dev, "timed out while correcting data\n"); dev_err(bch->dev, "timed out while correcting data\n");
ret = -1; ret = -ETIMEDOUT;
goto out; goto out;
} }
if (reg & BCH_BHINT_UNCOR) { if (reg & BCH_BHINT_UNCOR) {
dev_warn(bch->dev, "uncorrectable ECC error\n"); dev_warn(bch->dev, "uncorrectable ECC error\n");
ret = -1; ret = -EBADMSG;
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment