ibmasmfs: make register_filesystem the last failure exit
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 17 Mar 2012 05:50:32 +0000 (01:50 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 21 Mar 2012 01:29:44 +0000 (21:29 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
drivers/misc/ibmasm/module.c

index 1ccedb71e7289a9825482dd6529f25354452e380..168d8008f460ce3bcea322915e214989f15e22bb 100644 (file)
@@ -211,18 +211,17 @@ static void __exit ibmasm_exit (void)
 
 static int __init ibmasm_init(void)
 {
-       int result;
+       int result = pci_register_driver(&ibmasm_driver);
+       if (result)
+               return result;
 
        result = ibmasmfs_register();
        if (result) {
+               pci_unregister_driver(&ibmasm_driver);
                err("Failed to register ibmasmfs file system");
                return result;
        }
-       result = pci_register_driver(&ibmasm_driver);
-       if (result) {
-               ibmasmfs_unregister();
-               return result;
-       }
+
        ibmasm_register_panic_notifier();
        info(DRIVER_DESC " version " DRIVER_VERSION " loaded");
        return 0;