From: Tony Lindgren Date: Wed, 24 Aug 2016 16:46:32 +0000 (-0700) Subject: nand: Fix set_dev checks for no device X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=1cfce74fe5a2301ee9b384d9395ba95db930c9d6;p=u-boot.git 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 --- diff --git a/cmd/nand.c b/cmd/nand.c index e10349ac2b..97f1619ffd 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; }