[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170423095845.GA8692@amd>
Date: Sun, 23 Apr 2017 11:58:45 +0200
From: Pavel Machek <pavel@....cz>
To: Boris Brezillon <boris.brezillon@...e-electrons.com>
Cc: Dipen.Dudhat@...escale.com, richard@....at, dwmw2@...radead.org,
computersforpeace@...il.com, marek.vasut@...il.com,
cyrille.pitchen@...el.com, linux-mtd@...ts.infradead.org,
linux-kernel@...r.kernel.org, mark.marshall@...cronenergy.com,
b44839@...escale.com, prabhakar@...escale.com
Subject: tango_nand: is logic right in error cases? (was Re: fsl_ifc_nand:
are blank pages protected by ECC?)
Hi!
> > Maybe I figured it out. Unfortunately, it is only compile tested. Does
> > it look approximately right?
>
> Yep that's definitely better. Just one thing missing (see below),
> otherwise it looks good.
I'm copying from tango_nand, therefore I had to check tango_nand, too.
static int check_erased_page(struct nand_chip *chip, u8 *buf)
{
...
res = nand_check_erased_ecc_chunk(buf, pkt_size, ecc, ecc_size,
meta, meta_len,
chip->ecc.strength);
if (res < 0)
mtd->ecc_stats.failed++;
else
mtd->ecc_stats.corrected += res;
bitflips = max(res, bitflips);
...
return bitflips;
}
static int tango_read_page(struct mtd_info *mtd, struct nand_chip *chip,
u8 *buf, int oob_required, int page)
{
...
res = decode_error_report(nfc);
if (res < 0) {
chip->ecc.read_oob_raw(mtd, chip, page);
res = check_erased_page(chip, buf);
}
return res;
}
So nand_check_erased_ecc_chunk() returns < 0 (failed ECC), but then we
perform max() with bitflips (lets say 1, correctable ECC) and return
1? tango_read_page then returns 1 (correctable ECC) forgetting about
failed ECC...?
Best regards,
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists