Merge git://git.denx.de/u-boot-fsl-qoriq
[oweals/u-boot.git] / fs / jffs2 / jffs2_nand_1pass.c
index 9b7af09fe3998e4b1bb369d704dd52ef67a1a348..b16005e6045ffda2cdb6176bd856066be10b1556 100644 (file)
@@ -796,7 +796,11 @@ jffs2_1pass_build_lists(struct part_info * part)
        u32 counterN = 0;
 
        struct mtdids *id = part->dev->id;
-       mtd = nand_info + id->num;
+       mtd = get_nand_dev_by_index(id->num);
+       if (!mtd) {
+               pr_err("\nno NAND devices available\n");
+               return 0;
+       }
 
        /* if we are building a list we need to refresh the cache. */
        jffs_init_1pass_list(part);