[PATCH] net: sysctl: cleanup net_sysctl_init error exit paths

From: George G. Davis
Date: Thu May 16 2019 - 11:25:21 EST


Unwind net_sysctl_init error exit goto spaghetti code

Suggested-by: Joshua Frkuska <joshua_frkuska@xxxxxxxxxx>
Signed-off-by: George G. Davis <george_davis@xxxxxxxxxx>
---
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