From 7017838be53b39d685c1f8cbd276e69ce8a91166 Mon Sep 17 00:00:00 2001 From: Alexander Aring Date: Wed, 4 Jan 2012 15:08:25 +0100 Subject: nand_omap_gpmc: fix return value Fix return value, to notify if ecc correction appeared. Signed-off-by: Alexander Aring Signed-off-by: Sascha Hauer --- drivers/mtd/nand/nand_omap_gpmc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'drivers/mtd') diff --git a/drivers/mtd/nand/nand_omap_gpmc.c b/drivers/mtd/nand/nand_omap_gpmc.c index 9fb11323f7..3bb6d7961f 100644 --- a/drivers/mtd/nand/nand_omap_gpmc.c +++ b/drivers/mtd/nand/nand_omap_gpmc.c @@ -362,7 +362,7 @@ static int omap_correct_bch(struct mtd_info *mtd, uint8_t *dat, { struct nand_chip *nand = (struct nand_chip *)(mtd->priv); struct gpmc_nand_info *oinfo = (struct gpmc_nand_info *)(nand->priv); - int i, j, eccsize, eccflag, count; + int i, j, eccsize, eccflag, count, totalcount; unsigned int err_loc[8]; int blocks = 0; int select_4_8; @@ -380,6 +380,8 @@ static int omap_correct_bch(struct mtd_info *mtd, uint8_t *dat, else blocks = 1; + totalcount = 0; + for (i = 0; i < blocks; i++) { /* check if any ecc error */ eccflag = 0; @@ -401,6 +403,8 @@ static int omap_correct_bch(struct mtd_info *mtd, uint8_t *dat, count = decode_bch(select_4_8, calc_ecc, err_loc); if (count < 0) return count; + else + totalcount += count; } for (j = 0; j < count; j++) { @@ -415,7 +419,7 @@ static int omap_correct_bch(struct mtd_info *mtd, uint8_t *dat, dat += 512; } - return 0; + return totalcount; } static int omap_correct_hamming(struct mtd_info *mtd, uint8_t *dat, -- cgit v1.2.3