linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: jz4780: Update ecc correction error codes
@ 2016-01-08 16:45 Harvey Hunt
  2016-01-08 17:14 ` Boris Brezillon
  0 siblings, 1 reply; 3+ messages in thread
From: Harvey Hunt @ 2016-01-08 16:45 UTC (permalink / raw)
  To: linux-mtd, dwmw2, computersforpeace
  Cc: Harvey Hunt, Alex Smith, Boris Brezillon, linux-kernel

Update jz4780_bch_ecc_correct's return codes with appropriate values,
as specified in /include/linux/mtd/nand.h.

Signed-off-by: Harvey 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
---
 drivers/mtd/nand/jz4780_bch.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/mtd/nand/jz4780_bch.c b/drivers/mtd/nand/jz4780_bch.c
index 5954fbf..755499c 100644
--- a/drivers/mtd/nand/jz4780_bch.c
+++ b/drivers/mtd/nand/jz4780_bch.c
@@ -210,8 +210,8 @@ EXPORT_SYMBOL(jz4780_bch_calculate);
  * Given the raw data and the ECC read from the NAND device, detects and
  * corrects errors in the data.
  *
- * Return: the number of bit errors corrected, or -1 if there are too many
- * errors to correct or we timed out waiting for the controller.
+ * Return: the number of bit errors corrected, -EBADMSG if there are too many
+ * 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,
 		       u8 *buf, u8 *ecc_code)
@@ -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)) {
 		dev_err(bch->dev, "timed out while correcting data\n");
-		ret = -1;
+		ret = -ETIMEDOUT;
 		goto out;
 	}
 
 	if (reg & BCH_BHINT_UNCOR) {
 		dev_warn(bch->dev, "uncorrectable ECC error\n");
-		ret = -1;
+		ret = -EBADMSG;
 		goto out;
 	}
 
-- 
2.6.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-08 17:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-08 16:45 [PATCH] mtd: nand: jz4780: Update ecc correction error codes Harvey Hunt
2016-01-08 17:14 ` Boris Brezillon
2016-01-08 17:48   ` Brian Norris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).