Re: [PATCH] fsl_ifc_nand: fix handing of bit flips in erased nand

From: Boris Brezillon
Date: Wed May 17 2017 - 09:25:57 EST


On Wed, 17 May 2017 15:00:59 +0200
Pavel Machek <pavel@xxxxxx> wrote:

>
> > > @@ -904,6 +922,21 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)
> > > chip->ecc.algo = NAND_ECC_HAMMING;
> > > }
> > >
> > > + {
> > > + struct mtd_oob_region oobregion = { };
> > > +
> > > + mtd_ooblayout_ecc(mtd, 0, &oobregion);
> > > + if (!oobregion.length) {
> > > + dev_err(priv->dev, "No ECC in oobregion?\n");
> > > + return -EINVAL;
> > > + }
> > > + mtd_ooblayout_ecc(mtd, 1, &oobregion);
> > > + if (oobregion.length) {
> > > + dev_err(priv->dev, "Extra data in oobregion?\n");
> > > + return -EINVAL;
> > > + }
> > > + }
> >
> > This clearly doesn't belong in this patch. And if you really want to
> > check that, please create a separate function instead of defining a
> > non-conditional code block inside fsl_ifc_chip_init().
>
> I am not sure I want to check that. check_erased_page() can only
> handle layout with just one oobregion. If you think check is not
> needed, I'll happily remove the checking.

Let's drop it then. And please change the subject to "mtd: nand:
fsl_ifc: fix handing of bit flips in erased pages".

Thanks,

Boris