]> www.infradead.org Git - linux.git/commitdiff
mtd: ubi: Restore missing cleanup on ubi_init() failure path
authorBen Hutchings <ben.hutchings@mind.be>
Wed, 10 Apr 2024 22:42:41 +0000 (00:42 +0200)
committerRichard Weinberger <richard@nod.at>
Fri, 12 Jul 2024 19:43:09 +0000 (21:43 +0200)
We need to clean-up debugfs and ubiblock if we fail after initialising
them.

Signed-off-by: Ben Hutchings <ben.hutchings@mind.be>
Fixes: 927c145208b0 ("mtd: ubi: attach from device tree")
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/build.c

index 952c80269f570799fe5b794e6d4e8e80f433c7e3..30be4ed68fad297c3c8f6ba8f0214345f9ae3ffe 100644 (file)
@@ -1372,7 +1372,7 @@ static int __init ubi_init(void)
 
                /* See comment above re-ubi_is_module(). */
                if (ubi_is_module())
-                       goto out_slab;
+                       goto out_debugfs;
        }
 
        register_mtd_user(&ubi_mtd_notifier);
@@ -1387,6 +1387,9 @@ static int __init ubi_init(void)
 
 out_mtd_notifier:
        unregister_mtd_user(&ubi_mtd_notifier);
+       ubiblock_exit();
+out_debugfs:
+       ubi_debugfs_exit();
 out_slab:
        kmem_cache_destroy(ubi_wl_entry_slab);
 out_dev_unreg: