All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCHv3] nand: Fix set_dev checks for no device
@ 2016-08-24 16:46 Tony Lindgren
  2016-08-29 12:01 ` [U-Boot] [U-Boot, PATCHv3] " Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Tony Lindgren @ 2016-08-24 16:46 UTC (permalink / raw)
  To: u-boot

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 replacing the check with nand_info[dev] as
suggested by Scott Wood. The check for name existed before because before
the array-to-pointer conversion there was no way to directly test
nand_info[dev] for emptiness.

Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/cmd/nand.c b/cmd/nand.c
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -115,8 +115,7 @@ free_dat:
 
 static int set_dev(int dev)
 {
-	if (dev < 0 || dev >= CONFIG_SYS_MAX_NAND_DEVICE ||
-	    !nand_info[dev]->name) {
+	if (dev < 0 || dev >= CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[dev]) {
 		puts("No such device\n");
 		return -1;
 	}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [U-Boot] [U-Boot, PATCHv3] nand: Fix set_dev checks for no device
  2016-08-24 16:46 [U-Boot] [PATCHv3] nand: Fix set_dev checks for no device Tony Lindgren
@ 2016-08-29 12:01 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2016-08-29 12:01 UTC (permalink / raw)
  To: u-boot

On Wed, Aug 24, 2016 at 09:46:32AM -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 replacing the check with nand_info[dev] as
> suggested by Scott Wood. The check for name existed before because before
> the array-to-pointer conversion there was no way to directly test
> nand_info[dev] for emptiness.
> 
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> 
> diff --git a/cmd/nand.c b/cmd/nand.c

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160829/ba41bf4f/attachment.sig>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-29 12:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-24 16:46 [U-Boot] [PATCHv3] nand: Fix set_dev checks for no device Tony Lindgren
2016-08-29 12:01 ` [U-Boot] [U-Boot, PATCHv3] " Tom Rini

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.