Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1633862 > unrolled thread

Re: [PATCH v4 05/15] mtd: nand: add manufacturer specific initialization/detection steps

Started byBrian Norris <computersforpeace@gmail.com>
First post2017-05-01 23:10 +0200
Last post2017-05-02 11:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH v4 05/15] mtd: nand: add manufacturer specific  initialization/detection steps Brian Norris <computersforpeace@gmail.com> - 2017-05-01 23:10 +0200
    Re: [PATCH v4 05/15] mtd: nand: add manufacturer specific  initialization/detection steps Boris Brezillon <boris.brezillon@free-electrons.com> - 2017-05-02 11:10 +0200

#1633862 — Re: [PATCH v4 05/15] mtd: nand: add manufacturer specific initialization/detection steps

FromBrian Norris <computersforpeace@gmail.com>
Date2017-05-01 23:10 +0200
SubjectRe: [PATCH v4 05/15] mtd: nand: add manufacturer specific initialization/detection steps
Message-ID<tCqJY-5GO-5@gated-at.bofh.it>
Hi,

On Tue, Jan 03, 2017 at 02:01:25PM +0100, Boris Brezillon wrote:
> A lot of NANDs are implementing generic features in a non-generic way,
> or are providing advanced auto-detection logic where the NAND ID bytes
> meaning changes with the NAND generation.
> 
> Providing this vendor specific initialization step will allow us to get
> rid of the full ids in the nand_ids table or all the vendor specific
> cases added over the time in the generic NAND ID decoding logic.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> ---
>  drivers/mtd/nand/nand_base.c | 67 +++++++++++++++++++++++++++++++++++---------
>  include/linux/mtd/nand.h     | 35 +++++++++++++++++++++++
>  2 files changed, 89 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> index efb3ade568d8..8f80faa57984 100644
> --- a/drivers/mtd/nand/nand_base.c
> +++ b/drivers/mtd/nand/nand_base.c

...

> @@ -4163,6 +4196,10 @@ static int nand_detect(struct nand_chip *chip, struct nand_flash_dev *type)
>  	if (mtd->writesize > 512 && chip->cmdfunc == nand_command)
>  		chip->cmdfunc = nand_command_lp;
>  
> +	ret = nand_manufacturer_init(chip);
> +	if (ret)
> +		return ret;
> +

AFAICT, you're leaking anything that should be cleaned up in the
->cleanup() hook, for any error case after this. Not absolutely critical
to fix immediately, but I'd expect we should fix this in the 4.12 cycle.

>  	pr_info("device found, Manufacturer ID: 0x%02x, Chip ID: 0x%02x\n",
>  		maf_id, dev_id);
>  
> @@ -4907,6 +4944,10 @@ void nand_cleanup(struct nand_chip *chip)
>  	if (chip->badblock_pattern && chip->badblock_pattern->options
>  			& NAND_BBT_DYNAMICSTRUCT)
>  		kfree(chip->badblock_pattern);
> +
> +	/* Release manufacturer private data */
> +	if (chip->manufacturer.ops && chip->manufacturer.ops->cleanup)
> +		chip->manufacturer.ops->cleanup(chip);
>  }
>  EXPORT_SYMBOL_GPL(nand_cleanup);
>  

[...]

Brian

[toc] | [next] | [standalone]


#1634271

FromBoris Brezillon <boris.brezillon@free-electrons.com>
Date2017-05-02 11:10 +0200
Message-ID<tCBYJ-4BJ-9@gated-at.bofh.it>
In reply to#1633862
On Mon, 1 May 2017 14:02:46 -0700
Brian Norris <computersforpeace@gmail.com> wrote:

> Hi,
> 
> On Tue, Jan 03, 2017 at 02:01:25PM +0100, Boris Brezillon wrote:
> > A lot of NANDs are implementing generic features in a non-generic way,
> > or are providing advanced auto-detection logic where the NAND ID bytes
> > meaning changes with the NAND generation.
> > 
> > Providing this vendor specific initialization step will allow us to get
> > rid of the full ids in the nand_ids table or all the vendor specific
> > cases added over the time in the generic NAND ID decoding logic.
> > 
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > ---
> >  drivers/mtd/nand/nand_base.c | 67 +++++++++++++++++++++++++++++++++++---------
> >  include/linux/mtd/nand.h     | 35 +++++++++++++++++++++++
> >  2 files changed, 89 insertions(+), 13 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> > index efb3ade568d8..8f80faa57984 100644
> > --- a/drivers/mtd/nand/nand_base.c
> > +++ b/drivers/mtd/nand/nand_base.c  
> 
> ...
> 
> > @@ -4163,6 +4196,10 @@ static int nand_detect(struct nand_chip *chip, struct nand_flash_dev *type)
> >  	if (mtd->writesize > 512 && chip->cmdfunc == nand_command)
> >  		chip->cmdfunc = nand_command_lp;
> >  
> > +	ret = nand_manufacturer_init(chip);
> > +	if (ret)
> > +		return ret;
> > +  
> 
> AFAICT, you're leaking anything that should be cleaned up in the
> ->cleanup() hook, for any error case after this. Not absolutely critical  
> to fix immediately, but I'd expect we should fix this in the 4.12 cycle.

Yep, already acked the patch. Thanks for the fix.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web