]> git.ipfire.org Git - thirdparty/u-boot.git/blobdiff - fs/yaffs2/yaffs_uboot_glue.c
fs: use get_nand_dev_by_index()
[thirdparty/u-boot.git] / fs / yaffs2 / yaffs_uboot_glue.c
index f6630817d28a6d5f1bc16fb148dc0f3f6aeb0030..bd66d31697f5c3a4baf0441e3ca6c7585a651101 100644 (file)
@@ -166,11 +166,15 @@ void cmd_yaffs_devconfig(char *_mp, int flash_dev,
        char *mp = NULL;
        struct nand_chip *chip;
 
+       mtd = get_nand_dev_by_index(flash_dev);
+       if (!mtd) {
+               error("\nno NAND devices available\n");
+               return;
+       }
+
        dev = calloc(1, sizeof(*dev));
        mp = strdup(_mp);
 
-       mtd = nand_info[flash_dev];
-
        if (!dev || !mp) {
                /* Alloc error */
                printf("Failed to allocate memory\n");