[PATCH 14/16] proc: clean the ip_misc_proc_init and ip_proc_init_net error paths

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: David Miller <davem@...>
Cc: Linux Netdev List <netdev@...>
Date: Thursday, July 17, 2008 - 9:40 am

After all this stuff is moved outside, this function can look better.

Besides, I tuned the error path in ip_proc_init_net to make it have
only 2 exit points, not 3.

Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
---
 net/ipv4/proc.c |   15 +++------------
 1 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index 120e1f7..5543904 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -508,7 +508,7 @@ static const struct file_operations netstat_seq_fops = {
 static __net_init int ip_proc_init_net(struct net *net)
 {
 	if (!proc_net_fops_create(net, "sockstat", S_IRUGO, &sockstat_seq_fops))
-		return -ENOMEM;
+		goto out_sockstat;
 	if (!proc_net_fops_create(net, "netstat", S_IRUGO, &netstat_seq_fops))
 		goto out_netstat;
 	if (!proc_net_fops_create(net, "snmp", S_IRUGO, &snmp_seq_fops))
@@ -520,6 +520,7 @@ out_snmp:
 	proc_net_remove(net, "netstat");
 out_netstat:
 	proc_net_remove(net, "sockstat");
+out_sockstat:
 	return -ENOMEM;
 }
 
@@ -537,16 +538,6 @@ static __net_initdata struct pernet_operations ip_proc_ops = {
 
 int __init ip_misc_proc_init(void)
 {
-	int rc = 0;
-
-	if (register_pernet_subsys(&ip_proc_ops))
-		goto out_pernet;
-
-out:
-	return rc;
-
-out_pernet:
-	rc = -ENOMEM;
-	goto out;
+	return register_pernet_subsys(&ip_proc_ops);
 }
 
-- 
1.5.5.1

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/16] mib: finish with ipv4 mibs netnsization, Pavel Emelyanov, (Thu Jul 17, 9:19 am)
Re: [PATCH 0/16] mib: finish with ipv4 mibs netnsization, Pavel Emelyanov, (Mon Jul 21, 1:38 pm)
Re: [PATCH 0/16] mib: finish with ipv4 mibs netnsization, Eric W. Biederman, (Mon Jul 21, 8:24 pm)
[PATCH 15/16] proc: consolidate per-net single_open callers, Pavel Emelyanov, (Thu Jul 17, 9:41 am)
[PATCH 14/16] proc: clean the ip_misc_proc_init and ip_proc_..., Pavel Emelyanov, (Thu Jul 17, 9:40 am)
[PATCH 12/16] proc: create /proc/net/snmp file in each net, Pavel Emelyanov, (Thu Jul 17, 9:36 am)
[PATCH 10/16] ipvs: clean the init_ipv4_mibs error paths, Pavel Emelyanov, (Thu Jul 17, 9:33 am)
[PATCH 9/16] mib: put icmpmsg statistics on struct net, Pavel Emelyanov, (Thu Jul 17, 9:32 am)
[PATCH 8/16] mib: put icmp statistics on struct net, Pavel Emelyanov, (Thu Jul 17, 9:31 am)
[PATCH 7/16] mib: put udplite statistics on struct net, Pavel Emelyanov, (Thu Jul 17, 9:30 am)
[PATCH 6/16] mib: put udp statistics on struct net, Pavel Emelyanov, (Thu Jul 17, 9:29 am)
[PATCH 5/16] mib: put net statistics on struct net, Pavel Emelyanov, (Thu Jul 17, 9:28 am)
[PATCH 4/16] mib: put ip statistics on struct net, Pavel Emelyanov, (Thu Jul 17, 9:26 am)
[PATCH 3/16] mib: put tcp statistics on struct net, Pavel Emelyanov, (Thu Jul 17, 9:25 am)
[PATCH 2/16] ipv4: add pernet mib operations, Pavel Emelyanov, (Thu Jul 17, 9:23 am)
[PATCH 1/16] mib: add netns/mib.h file, Pavel Emelyanov, (Thu Jul 17, 9:21 am)