Commit 1cfce74fe5a2301ee9b384d9395ba95db930c9d6

Authored by Tony Lindgren
Committed by Tom Rini
1 parent c21fc7e223

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>

Showing 1 changed file with 1 additions and 2 deletions Side-by-side Diff

... ... @@ -115,8 +115,7 @@
115 115  
116 116 static int set_dev(int dev)
117 117 {
118   - if (dev < 0 || dev >= CONFIG_SYS_MAX_NAND_DEVICE ||
119   - !nand_info[dev]->name) {
  118 + if (dev < 0 || dev >= CONFIG_SYS_MAX_NAND_DEVICE || !nand_info[dev]) {
120 119 puts("No such device\n");
121 120 return -1;
122 121 }