LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "George G. Davis" <george_davis@mentor.com>
To: "David S. Miller" <davem@davemloft.net>,
	"open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>
Cc: "George G. Davis" <george_davis@mentor.com>
Subject: [PATCH] net: sysctl: cleanup net_sysctl_init error exit paths
Date: Thu, 16 May 2019 11:23:08 -0400	[thread overview]
Message-ID: <1558020189-16843-1-git-send-email-george_davis@mentor.com> (raw)

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


             reply	other threads:[~2019-05-16 15:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-16 15:23 George G. Davis [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1558020189-16843-1-git-send-email-george_davis@mentor.com \
    --to=george_davis@mentor.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --subject='Re: [PATCH] net: sysctl: cleanup net_sysctl_init error exit paths' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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