[PATCH 05/10] mtd nand omap: fail on bch decode failure

Sascha Hauer s.hauer at pengutronix.de
Tue Nov 8 08:01:48 EST 2011


The driver used to print an error when bch decoing failed, but
did not actually throw an error. Fix this.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 drivers/mtd/nand/nand_omap_gpmc.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/nand_omap_gpmc.c b/drivers/mtd/nand/nand_omap_gpmc.c
index 8dd6b8c..9097dde 100644
--- a/drivers/mtd/nand/nand_omap_gpmc.c
+++ b/drivers/mtd/nand/nand_omap_gpmc.c
@@ -377,8 +377,11 @@ static int omap_correct_bch(struct mtd_info *mtd, uint8_t *dat,
 		}
 
 		count = 0;
-		if (eccflag == 1)
+		if (eccflag == 1) {
 			count = decode_bch(select_4_8, calc_ecc, err_loc);
+			if (count < 0)
+				return count;
+		}
 
 		for (j = 0; j < count; j++) {
 			if (err_loc[j] < 4096)
-- 
1.7.7




More information about the barebox mailing list