]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
rfkill: Cleanup error handling in rfkill_init()
authorMichał Kępień <kernel@kempniu.pl>
Thu, 8 Dec 2016 07:30:51 +0000 (08:30 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 13 Dec 2016 15:20:29 +0000 (16:20 +0100)
Use a separate label per error condition in rfkill_init() to make it a
bit cleaner and easier to extend.

Signed-off-by: Michał Kępień <kernel@kempniu.pl>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/rfkill/core.c

index 184bb711a06d6b257fdca10c2100da80fac7766f..9eb26a4cdac8a690912b6cb637b902888258834c 100644 (file)
@@ -1263,24 +1263,25 @@ static int __init rfkill_init(void)
 
        error = class_register(&rfkill_class);
        if (error)
-               goto out;
+               goto error_class;
 
        error = misc_register(&rfkill_miscdev);
-       if (error) {
-               class_unregister(&rfkill_class);
-               goto out;
-       }
+       if (error)
+               goto error_misc;
 
 #ifdef CONFIG_RFKILL_INPUT
        error = rfkill_handler_init();
-       if (error) {
-               misc_deregister(&rfkill_miscdev);
-               class_unregister(&rfkill_class);
-               goto out;
-       }
+       if (error)
+               goto error_input;
 #endif
 
- out:
+       return 0;
+
+error_input:
+       misc_deregister(&rfkill_miscdev);
+error_misc:
+       class_unregister(&rfkill_class);
+error_class:
        return error;
 }
 subsys_initcall(rfkill_init);