netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] net: rfkill: Cleanup error handling in rfkill_init()
@ 2016-12-08  7:30 Michał Kępień
  2016-12-08  7:30 ` [PATCH v2 2/2] net: rfkill: Add rfkill-any LED trigger Michał Kępień
  2016-12-13 15:16 ` [PATCH v2 1/2] net: rfkill: Cleanup error handling in rfkill_init() Johannes Berg
  0 siblings, 2 replies; 4+ messages in thread
From: Michał Kępień @ 2016-12-08  7:30 UTC (permalink / raw)
  To: Johannes Berg, David S . Miller
  Cc: linux-wireless-u79uwXL29TY76Z2rM5mHXA,
	netdev-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

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-ePNcKBjznIDVItvQsEIGlw@public.gmane.org>
---
No changes from v1.

 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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-12-13 15:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-08  7:30 [PATCH v2 1/2] net: rfkill: Cleanup error handling in rfkill_init() Michał Kępień
2016-12-08  7:30 ` [PATCH v2 2/2] net: rfkill: Add rfkill-any LED trigger Michał Kępień
2016-12-13 15:18   ` Johannes Berg
2016-12-13 15:16 ` [PATCH v2 1/2] net: rfkill: Cleanup error handling in rfkill_init() Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).