[PATCH 7/7] mtd: driver _read() returns max_bitflips; mtd_read() returns -EUCLEAN
Shmulik Ladkani
shmulik.ladkani at gmail.com
Wed Apr 25 06:14:32 EDT 2012
Hi Mike,
Reviewed mtdcore.c, mtdpart.c and nand_base.c.
Looks very good.
Minor comments below.
On Tue, 24 Apr 2012 12:18:25 -0700 Mike Dunn <mikedunn at newsguy.com> wrote:
> diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
> index 9651c06..d6321f6 100644
> --- a/drivers/mtd/mtdpart.c
> +++ b/drivers/mtd/mtdpart.c
> @@ -67,12 +67,12 @@ static int part_read(struct mtd_info *mtd, loff_t from, size_t len,
> stats = part->master->ecc_stats;
> res = part->master->_read(part->master, from + part->offset, len,
> retlen, buf);
> - if (unlikely(res)) {
> - if (mtd_is_bitflip(res))
> - mtd->ecc_stats.corrected += part->master->ecc_stats.corrected - stats.corrected;
> - if (mtd_is_eccerr(res))
> - mtd->ecc_stats.failed += part->master->ecc_stats.failed - stats.failed;
> - }
> + if (unlikely(mtd_is_eccerr(res)))
> + mtd->ecc_stats.failed +=
> + part->master->ecc_stats.failed - stats.failed;
> + else
> + mtd->ecc_stats.corrected +=
> + part->master->ecc_stats.corrected - stats.corrected;
> return res;
> }
Probably need {} around the statements within the conditions.
Also I think there's no reason to execute "corrected +=" in case 'res'
is zero (although no harm).
Regards,
Shmulik
More information about the linux-mtd
mailing list