summaryrefslogtreecommitdiff
path: root/net/rfkill
diff options
context:
space:
mode:
authorMichał Kępień <kernel@kempniu.pl>2016-12-08 08:30:51 +0100
committerJohannes Berg <johannes.berg@intel.com>2016-12-13 16:20:29 +0100
commit6124c53edeeaac4394755ebb38c522bc4eef1460 (patch)
tree94a4aeb453d84242608bad81ea0fa9f01ab59cd1 /net/rfkill
parent4a5eccaa93505cd186939a01d7c115568b1881a6 (diff)
rfkill: Cleanup error handling in rfkill_init()
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>
Diffstat (limited to 'net/rfkill')
-rw-r--r--net/rfkill/core.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index 184bb711a06d..9eb26a4cdac8 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -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);