]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
nand: Fix some more NULL name tests
authorScott Wood <oss@buserror.net>
Thu, 1 Sep 2016 22:31:31 +0000 (17:31 -0500)
committerScott Wood <oss@buserror.net>
Fri, 2 Sep 2016 01:08:48 +0000 (20:08 -0500)
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")
Signed-off-by: Scott Wood <oss@buserror.net>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Tony Lindgren <tony@atomide.com>
Acked-by: Tony Lindgren <tony@atomide.com>
cmd/nand.c
drivers/dfu/dfu_nand.c
drivers/mtd/nand/omap_gpmc.c

index c25e25af3d0ca71e3a2f2ef6e1a1cbf84b8d57c0..c16ec77ed454fe9716997f8114b9597c034756d5 100644 (file)
@@ -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;
        }
index 9fb874c0bcd4f07c9ab1f6732117f4d7ed5a3c46..23f15716e09413284e826a07c653c14ab1420626 100644 (file)
@@ -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;
                }
index 6e201d68e5135671b9d5c8f4324c1bc34bf89a10..af618fc044c6fb5285ed03a3b329d141d6f5b44a 100644 (file)
@@ -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;
        }