diff options
author | Alexander Aring <a.aring@phytec.de> | 2012-01-04 15:08:25 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-01-05 10:31:24 +0100 |
commit | 7017838be53b39d685c1f8cbd276e69ce8a91166 (patch) | |
tree | 72e9913d280538797f255fe1db8e4bff4130fddf /drivers/mtd | |
parent | 0d22025084222720b85c6019e8eb728e71dc8986 (diff) | |
download | barebox-7017838be53b39d685c1f8cbd276e69ce8a91166.tar.gz barebox-7017838be53b39d685c1f8cbd276e69ce8a91166.tar.xz |
nand_omap_gpmc: fix return value
Fix return value, to notify if ecc
correction appeared.
Signed-off-by: Alexander Aring <a.aring@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/nand_omap_gpmc.c | 8 |
1 files changed, 6 insertions, 2 deletions
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, |