]> git.sur5r.net Git - u-boot/blobdiff - fs/yaffs2/yaffs_uboot_glue.c
treewide: replace with error() with pr_err()
[u-boot] / fs / yaffs2 / yaffs_uboot_glue.c
index f6630817d28a6d5f1bc16fb148dc0f3f6aeb0030..2a70e4a543e0b9e8608c6e6fd803988ac3af3a3e 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) {
+               pr_err("\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");