if "ubi part" fails, reset also mtd_devs to 0, as
further "ubi part" would use wrong mtd_devs.
Signed-off-by: Heiko Schocher <hs@denx.de>
 out_class:
        class_destroy(ubi_class);
 out:
+#ifdef __UBOOT__
+       /* Reset any globals that the driver depends on being zeroed */
+       mtd_devs = 0;
+#endif
        ubi_err("cannot initialize UBI, error %d", err);
        return err;
 }
        misc_deregister(&ubi_ctrl_cdev);
        class_remove_file(ubi_class, &ubi_version);
        class_destroy(ubi_class);
+#ifdef __UBOOT__
+       /* Reset any globals that the driver depends on being zeroed */
+       mtd_devs = 0;
+#endif
 }
 module_exit(ubi_exit);