[PATCH v4 3/3] mtd: Remove duplicate checks on mtd_oob_ops parameter

Miquel RAYNAL miquel.raynal at free-electrons.com
Tue Jan 9 00:19:08 PST 2018


On Tue, 9 Jan 2018 09:11:21 +0100
Boris Brezillon <boris.brezillon at free-electrons.com> wrote:

> On Tue, 9 Jan 2018 08:19:53 +0100
> Miquel RAYNAL <miquel.raynal at free-electrons.com> wrote:
> 
> > Hello Boris,
> > 
> > On Mon, 8 Jan 2018 23:30:10 +0100
> > Boris Brezillon <boris.brezillon at free-electrons.com> wrote:
> >   
> > > On Mon, 8 Jan 2018 23:04:55 +0100
> > > Miquel RAYNAL <miquel.raynal at free-electrons.com> wrote:
> > >     
> > > > Hello Boris,
> > > > 
> > > > On Mon,  8 Jan 2018 22:15:42 +0100
> > > > Boris Brezillon <boris.brezillon at free-electrons.com> wrote:
> > > >       
> > > > > Some of the check done in custom ->_read/write_oob()
> > > > > implementation are already done by the core (in
> > > > > mtd_check_oob_ops()).        
> > > > 
> > > > Not sure this is relevant here as your series introduces
> > > > changes for the SPI NAND framework, but there are other places
> > > > where these checks are, IMHO, also redundant and could be
> > > > removed. The "past end" string when grepped in the MTD folder
> > > > core returns a few more hits.
> > > > 
> > > > In the NAND core:
> > > >   - nand_do_read_oob()
> > > >   - nand_read_oob()
> > > >   - nand_do_write_oob()
> > > >   - nand_write_oob()      
> > > 
> > > That's true for nand_read/write_oob(). The one in
> > > nand_do_write_oob() is still needed because mtd_check_oob_ops()
> > > allows OOB writes crossing a page boundary. Finally, I don't see
> > > any boundary checks in nand_do_read_oob().    
> > 
> > I forgot that crossing page boundaries was not a use case of
> > mtd_check_oob_ops(), thanks for pointing it. However in
> > nand_do_read/write_oob(), the comment and the code really state the
> > checked boundary is the end of the device. So are you sure these two
> > checks are needed?
> > 
> > [1]http://elixir.free-electrons.com/linux/latest/source/drivers/mtd/nand/nand_base.c#L2226
> > [2]http://elixir.free-electrons.com/linux/latest/source/drivers/mtd/nand/nand_base.c#L2886  
> 
> You mean, the lines I remove in this patch? :P

Oops, sorry for the noise then!

Thanks,
Miquèl



More information about the linux-mtd mailing list