OSDN Git Service

Merge Linux 4.4.206-rc1 into 10
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / drivers / mtd / ubi / build.c
index 7c16a9b..2af841c 100644 (file)
@@ -1203,10 +1203,10 @@ int ubi_detach_mtd_dev(int ubi_num, int anyway)
        ubi_wl_close(ubi);
        ubi_free_internal_volumes(ubi);
        vfree(ubi->vtbl);
-       put_mtd_device(ubi->mtd);
        vfree(ubi->peb_buf);
        vfree(ubi->fm_buf);
        ubi_msg(ubi, "mtd%d is detached", ubi->mtd->index);
+       put_mtd_device(ubi->mtd);
        put_device(&ubi->dev);
        return 0;
 }