[U-Boot] [PATCH] nand: Fix set_dev checks for no device

Tony Lindgren tony at atomide.com
Wed Aug 24 00:04:42 CEST 2016


* Scott Wood <oss at buserror.net> [160823 14:31]:
> On Tue, 2016-08-23 at 14:26 -0700, Tony Lindgren wrote:
> > If we do nand device 0 command in u-boot on a device that has NAND support
> > enabled but no NAND chip, we can get data abort at least on omaps.
> > 
> > Fix the issue by adding a check for nand_info[dev].
> > 
> > Signed-off-by: Tony Lindgren <tony at atomide.com>
> > --- a/cmd/nand.c
> > +++ b/cmd/nand.c
> > @@ -116,7 +116,7 @@ free_dat:
> >  static int set_dev(int dev)
> >  {
> >  	if (dev < 0 || dev >= CONFIG_SYS_MAX_NAND_DEVICE ||
> > -	    !nand_info[dev]->name) {
> > +	    !nand_info[dev] || !nand_info[dev]->name) {
> >  		puts("No such device\n");
> >  		return -1;
> >  	}
> 
> The new !nand_info[dev] check can replace the old name check (similarly to how
> commit 4cc9699be7ffc replaced the old zero-blocksize check).

Do you mean we can now leave out the test for !nand_info[dev]->name
in set_dev() with this patch?

Regards,

Tony



More information about the U-Boot mailing list