aboutsummaryrefslogtreecommitdiff
path: root/cmd/nand.c
diff options
context:
space:
mode:
authorTony Lindgren <tony@atomide.com>2016-08-24 09:46:32 -0700
committerTom Rini <trini@konsulko.com>2016-08-26 17:04:58 -0400
commit1cfce74fe5a2301ee9b384d9395ba95db930c9d6 (patch)
tree6c27f90d1e1a1f5c8eb06ba99a627638daf210fb /cmd/nand.c
parentc21fc7e223ebad72735b9d02bcbd8878ae026fef (diff)
downloadu-boot-1cfce74fe5a2301ee9b384d9395ba95db930c9d6.zip
u-boot-1cfce74fe5a2301ee9b384d9395ba95db930c9d6.tar.gz
u-boot-1cfce74fe5a2301ee9b384d9395ba95db930c9d6.tar.bz2
nand: Fix set_dev checks for no device
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>
Diffstat (limited to 'cmd/nand.c')
-rw-r--r--cmd/nand.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/cmd/nand.c b/cmd/nand.c
index e10349a..97f1619 100644
--- 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;
}