All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <oss@buserror.net>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] nand: Fix set_dev checks for no device
Date: Tue, 23 Aug 2016 16:30:39 -0500	[thread overview]
Message-ID: <1471987839.25630.277.camel@buserror.net> (raw)
In-Reply-To: <20160823212621.r6absphhojmfulr4@atomide.com>

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@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).

-Scott

  reply	other threads:[~2016-08-23 21:30 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-23 21:26 [U-Boot] [PATCH] nand: Fix set_dev checks for no device Tony Lindgren
2016-08-23 21:30 ` Scott Wood [this message]
2016-08-23 22:04   ` Tony Lindgren
2016-08-23 22:07     ` Scott Wood
2016-08-23 22:21       ` Tony Lindgren
2016-08-24  0:04         ` Scott Wood
2016-08-24 16:47           ` Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1471987839.25630.277.camel@buserror.net \
    --to=oss@buserror.net \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.