diff options
author | Guido MartÃnez <guido@vanguardiasur.com.ar> | 2015-01-02 14:49:10 -0300 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2015-01-05 16:40:18 -0500 |
commit | eb54d2c70ce3b14e0c9ae141e216d5ad0b22d0dd (patch) | |
tree | b784c3ad1724edba2388d6c6062471c1ad896100 /drivers/mtd | |
parent | 001475a0f58f33c83646254ef46640556cd3fe77 (diff) | |
download | u-boot-imx-eb54d2c70ce3b14e0c9ae141e216d5ad0b22d0dd.zip u-boot-imx-eb54d2c70ce3b14e0c9ae141e216d5ad0b22d0dd.tar.gz u-boot-imx-eb54d2c70ce3b14e0c9ae141e216d5ad0b22d0dd.tar.bz2 |
mtd: nand: omap_gpmc: fix error handling
"err" was an unsigned variable, causing negative error codes to turn
into positive values, which are interpreted as an amount of succesfully
corrected bitflips (and thus not an error).
In particular, this resulted in that if the elm reports uncorrectable
errors (-EBADMSG), the MTD layer (and UBI) falsely succeeded.
Signed-off-by: Guido MartÃnez <guido@vanguardiasur.com.ar>
Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/omap_gpmc.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mtd/nand/omap_gpmc.c b/drivers/mtd/nand/omap_gpmc.c index 93829a4..459904d 100644 --- a/drivers/mtd/nand/omap_gpmc.c +++ b/drivers/mtd/nand/omap_gpmc.c @@ -368,8 +368,9 @@ static int omap_correct_data_bch(struct mtd_info *mtd, uint8_t *dat, uint32_t error_loc[ELM_MAX_ERROR_COUNT]; enum bch_level bch_type; uint32_t i, ecc_flag = 0; - uint8_t count, err = 0; + uint8_t count; uint32_t byte_pos, bit_pos; + int err = 0; /* check calculated ecc */ for (i = 0; i < ecc->bytes && !ecc_flag; i++) { |