LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] net: sysctl: cleanup net_sysctl_init error exit paths
@ 2019-05-16 15:23 George G. Davis
  2019-05-16 21:27 ` David Miller
  0 siblings, 1 reply; 7+ messages in thread
From: George G. Davis @ 2019-05-16 15:23 UTC (permalink / raw)
  To: David S. Miller, open list:NETWORKING [GENERAL], open list
  Cc: George G. Davis

Unwind net_sysctl_init error exit goto spaghetti code

Suggested-by: Joshua Frkuska <joshua_frkuska@mentor.com>
Signed-off-by: George G. Davis <george_davis@mentor.com>
---
 net/sysctl_net.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/net/sysctl_net.c b/net/sysctl_net.c
index 9aed6fe1bf1a..7710a2d7f79a 100644
--- a/net/sysctl_net.c
+++ b/net/sysctl_net.c
@@ -104,14 +104,12 @@ __init int net_sysctl_init(void)
 	if (!net_header)
 		goto out;
 	ret = register_pernet_subsys(&sysctl_pernet_ops);
-	if (ret)
-		goto out1;
-out:
-	return ret;
-out1:
+	if (!ret)
+		goto out;
 	unregister_sysctl_table(net_header);
 	net_header = NULL;
-	goto out;
+out:
+	return ret;
 }
 
 struct ctl_table_header *register_net_sysctl(struct net *net,
-- 
2.7.4


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

end of thread, other threads:[~2019-09-18 15:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-16 15:23 [PATCH] net: sysctl: cleanup net_sysctl_init error exit paths George G. Davis
2019-05-16 21:27 ` David Miller
2019-05-17 14:43   ` George G. Davis
2019-07-08 22:47     ` George G. Davis
2019-09-17 15:53       ` George G. Davis
2019-09-18  9:44         ` Nicolas Dichtel
2019-09-18 15:00           ` George G. Davis

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).