|
@@ -992,6 +992,9 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
|
|
|
goto out_detach;
|
|
goto out_detach;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /* Make device "available" before it becomes accessible via sysfs */
|
|
|
|
|
+ ubi_devices[ubi_num] = ubi;
|
|
|
|
|
+
|
|
|
err = uif_init(ubi, &ref);
|
|
err = uif_init(ubi, &ref);
|
|
|
if (err)
|
|
if (err)
|
|
|
goto out_detach;
|
|
goto out_detach;
|
|
@@ -1036,7 +1039,6 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
|
|
|
wake_up_process(ubi->bgt_thread);
|
|
wake_up_process(ubi->bgt_thread);
|
|
|
spin_unlock(&ubi->wl_lock);
|
|
spin_unlock(&ubi->wl_lock);
|
|
|
|
|
|
|
|
- ubi_devices[ubi_num] = ubi;
|
|
|
|
|
ubi_notify_all(ubi, UBI_VOLUME_ADDED, NULL);
|
|
ubi_notify_all(ubi, UBI_VOLUME_ADDED, NULL);
|
|
|
return ubi_num;
|
|
return ubi_num;
|
|
|
|
|
|
|
@@ -1047,6 +1049,7 @@ out_uif:
|
|
|
ubi_assert(ref);
|
|
ubi_assert(ref);
|
|
|
uif_close(ubi);
|
|
uif_close(ubi);
|
|
|
out_detach:
|
|
out_detach:
|
|
|
|
|
+ ubi_devices[ubi_num] = NULL;
|
|
|
ubi_wl_close(ubi);
|
|
ubi_wl_close(ubi);
|
|
|
ubi_free_internal_volumes(ubi);
|
|
ubi_free_internal_volumes(ubi);
|
|
|
vfree(ubi->vtbl);
|
|
vfree(ubi->vtbl);
|