From: Michał Kępień Date: Thu, 8 Dec 2016 07:30:51 +0000 (+0100) Subject: rfkill: Cleanup error handling in rfkill_init() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6124c53edeeaac4394755ebb38c522bc4eef1460;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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ń Signed-off-by: Johannes Berg --- 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);