Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1533257

[PATCH 1/2] net: rfkill: Cleanup error handling in rfkill_init()

From Michał Kępień <kernel@kempniu.pl>
Newsgroups linux.kernel
Subject [PATCH 1/2] net: rfkill: Cleanup error handling in rfkill_init()
Date 2016-11-30 13:10 +0100
Message-ID <sJbS2-5UT-7@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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>
---
 net/rfkill/core.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/net/rfkill/core.c b/net/rfkill/core.c
index 884027f..f28e441 100644
--- a/net/rfkill/core.c
+++ b/net/rfkill/core.c
@@ -1266,24 +1266,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);
-- 
2.10.2

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH 1/2] net: rfkill: Cleanup error handling in rfkill_init() Michał Kępień <kernel@kempniu.pl> - 2016-11-30 13:10 +0100
  [PATCH 2/2] net: rfkill: Add rfkill-any LED trigger Michał Kępień <kernel@kempniu.pl> - 2016-11-30 13:10 +0100
    Re: [PATCH 2/2] net: rfkill: Add rfkill-any LED trigger kbuild test robot <lkp@intel.com> - 2016-12-01 18:40 +0100
      Re: [PATCH 2/2] net: rfkill: Add rfkill-any LED trigger Michał Kępień <kernel@kempniu.pl> - 2016-12-01 21:10 +0100
        Re: [PATCH 2/2] net: rfkill: Add rfkill-any LED trigger Johannes Berg <johannes@sipsolutions.net> - 2016-12-05 15:00 +0100

csiph-web