Skip to contentSkip to conversation

nand: Fix some more NULL name tests

PATCH New Scott Wood 2 participants 2 messages Sep 1, 2016

Subsystems (2)
lore
Share & tools
lore

Scott Wood

author
#0 lore raw

PATCH 1/1 nand: Fix some more NULL name tests

Now that nand_info[] is an array of pointers we need to test the pointer itself rather than using name as a proxy for NULLness.

Fixes b616d9b0a708eb9 ("nand: Embed mtd_info in struct nand_chip")
Cc Lukasz Majewski <[email protected]>
Cc Tony Lindgren <[email protected]>
---
 cmd/nand.c                   | 2 +-
 drivers/dfu/dfu_nand.c       | 4 ++--
 drivers/mtd/nand/omap_gpmc.c | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
cmd/nand.c +1 -1
index c25e25a..c16ec77 100644
@@ -191,7 +191,7 @@ int do_nand_env_oob(cmd_tbl_t *cmdtp, int argc, char *const argv[])
 	struct mtd_info *mtd = nand_info[0];
 	char *cmd = argv[1];
 
-	if (CONFIG_SYS_MAX_NAND_DEVICE == 0 || !mtd->name) {
+	if (CONFIG_SYS_MAX_NAND_DEVICE == 0 || !mtd) {
 		puts("no devices available\n");
 		return 1;
 	}
drivers/dfu/dfu_nand.c +2 -2
index 9fb874c..23f1571 100644
@@ -39,7 +39,7 @@ static int nand_block_op(enum dfu_op op, struct dfu_entity *dfu,
 
 	if (nand_curr_device < 0 ||
 	    nand_curr_device >= CONFIG_SYS_MAX_NAND_DEVICE ||
-	    !nand_info[nand_curr_device]->name) {
+	    !nand_info[nand_curr_device]) {
 		printf("%s: invalid nand device\n", __func__);
 		return -1;
 	}
@@ -148,7 +148,7 @@ static int dfu_flush_medium_nand(struct dfu_entity *dfu)
 
 		if (nand_curr_device < 0 ||
 		    nand_curr_device >= CONFIG_SYS_MAX_NAND_DEVICE ||
-		    !nand_info[nand_curr_device]->name) {
+		    !nand_info[nand_curr_device]) {
 			printf("%s: invalid nand device\n", __func__);
 			return -1;
 		}
drivers/mtd/nand/omap_gpmc.c +1 -1
index 6e201d6..af618fc 100644
@@ -899,7 +899,7 @@ int __maybe_unused omap_nand_switch_ecc(uint32_t hardware, uint32_t eccstrength)
 
 	if (nand_curr_device < 0 ||
 	    nand_curr_device >= CONFIG_SYS_MAX_NAND_DEVICE ||
-	    !nand_info[nand_curr_device]->name) {
+	    !nand_info[nand_curr_device]) {
 		printf("nand: error: no NAND devices found\n");
 		return -ENODEV;
 	}
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/1 nand: Fix some more NULL name tests

Quoted 7 lines · Scott Wood

Now that nand_info[] is an array of pointers we need to test the pointer itself rather than using name as a proxy for NULLness.

Fixes b616d9b0a708eb9 ("nand: Embed mtd_info in struct nand_chip")
Cc Lukasz Majewski <[email protected]>
Cc Tony Lindgren <[email protected]>

Thanks for doing this, I totally forgot about this sorry. Anyways: