提交 60bdde95 编写于 作者: P Pavel Emelyanov 提交者: David S. Miller

proc: clean the ip_misc_proc_init and ip_proc_init_net error paths

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: NPavel Emelyanov <xemul@openvz.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 8e3461d0
...@@ -508,7 +508,7 @@ static const struct file_operations netstat_seq_fops = { ...@@ -508,7 +508,7 @@ static const struct file_operations netstat_seq_fops = {
static __net_init int ip_proc_init_net(struct net *net) static __net_init int ip_proc_init_net(struct net *net)
{ {
if (!proc_net_fops_create(net, "sockstat", S_IRUGO, &sockstat_seq_fops)) 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)) if (!proc_net_fops_create(net, "netstat", S_IRUGO, &netstat_seq_fops))
goto out_netstat; goto out_netstat;
if (!proc_net_fops_create(net, "snmp", S_IRUGO, &snmp_seq_fops)) if (!proc_net_fops_create(net, "snmp", S_IRUGO, &snmp_seq_fops))
...@@ -520,6 +520,7 @@ static __net_init int ip_proc_init_net(struct net *net) ...@@ -520,6 +520,7 @@ static __net_init int ip_proc_init_net(struct net *net)
proc_net_remove(net, "netstat"); proc_net_remove(net, "netstat");
out_netstat: out_netstat:
proc_net_remove(net, "sockstat"); proc_net_remove(net, "sockstat");
out_sockstat:
return -ENOMEM; return -ENOMEM;
} }
...@@ -537,16 +538,6 @@ static __net_initdata struct pernet_operations ip_proc_ops = { ...@@ -537,16 +538,6 @@ static __net_initdata struct pernet_operations ip_proc_ops = {
int __init ip_misc_proc_init(void) int __init ip_misc_proc_init(void)
{ {
int rc = 0; return register_pernet_subsys(&ip_proc_ops);
if (register_pernet_subsys(&ip_proc_ops))
goto out_pernet;
out:
return rc;
out_pernet:
rc = -ENOMEM;
goto out;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册