提交 6124c53e 编写于 作者: M Michał Kępień 提交者: Johannes Berg

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: NMichał Kępień <kernel@kempniu.pl>
Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
上级 4a5eccaa
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册