[PATCH 2/2] mtd: nand: check the return code of 'read_oob/read_oob_raw'

Artem Bityutskiy dedekind1 at gmail.com
Fri May 11 09:34:05 EDT 2012


On Fri, 2012-05-11 at 15:54 +0300, Shmulik Ladkani wrote:
> Hi Artem,
> 
> On Fri, 11 May 2012 14:48:11 +0300 Artem Bityutskiy <dedekind1 at gmail.com> wrote:
> > On Wed, 2012-05-09 at 13:13 +0300, Shmulik Ladkani wrote:
> > > @@ -1826,9 +1827,12 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
> > >  
> > >  	while (1) {
> > >  		if (ops->mode == MTD_OPS_RAW)
> > > -			chip->ecc.read_oob_raw(mtd, chip, page);
> > > +			ret = chip->ecc.read_oob_raw(mtd, chip, page);
> > >  		else
> > > -			chip->ecc.read_oob(mtd, chip, page);
> > > +			ret = chip->ecc.read_oob(mtd, chip, page);
> > > +
> > > +		if (ret < 0)
> > > +			break;
> > 
> > For page reading the convention is that we keep reading and try to read
> > everything anyway, I guess it is reasonable thing to do for OOB as well?
> 
> AFAIU, we actually _stop_ reading upon 'ecc.read_page()' error.
> And 'ops->retlen' is updated to reflect actual bytes sucessfully read.

Yes, you are right. It should keep reading in case of an ECC error, not
in case of any error.

-- 
Best Regards,
Artem Bityutskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.infradead.org/pipermail/linux-mtd/attachments/20120511/d05446e4/attachment.sig>


More information about the linux-mtd mailing list