Hi Boris, Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx> wrote on Sat, 25 Apr 2020 10:22:25 +0200: > On Fri, 24 Apr 2020 18:40:36 +0200 > Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote: > > > During ONFI detection, the CRC derived from the parameter page and the > > CRC supposed to be at the end of the parameter page are compared. If > > they do not match, the second then the third copies of the page are > > tried. > > > > The current implementation compares the newly derived CRC with the CRC > > contained in the first page only. So if this particular CRC area has > > been corrupted, then the detection will fail for a wrong reason. > > > > Fix this issue by checking the derived CRC against the right one. > > > Yes, but given the fact that we moved this code out of nand_base.c sending it to stable would not apply, I don't know what's best in this case? The faulty commit being 39138c1f4a31 mtd: rawnand: use bit-wise majority to recover the ONFI param page > This one probably deserves Fixes and Cc-stable tags. > > > Signed-off-by: Miquel Raynal <miquel.raynal@xxxxxxxxxxx> > > Reviewed-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxxxx> > > --- > > drivers/mtd/nand/raw/nand_onfi.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/mtd/nand/raw/nand_onfi.c b/drivers/mtd/nand/raw/nand_onfi.c > > index 0b879bd0a68c..8fe8d7bdd203 100644 > > --- a/drivers/mtd/nand/raw/nand_onfi.c > > +++ b/drivers/mtd/nand/raw/nand_onfi.c > > @@ -173,7 +173,7 @@ int nand_onfi_detect(struct nand_chip *chip) > > } > > > > if (onfi_crc16(ONFI_CRC_BASE, (u8 *)&p[i], 254) == > > - le16_to_cpu(p->crc)) { > > + le16_to_cpu(p[i].crc)) { > > if (i) > > memcpy(p, &p[i], sizeof(*p)); > > break; > Thanks, Miquèl ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/