diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-12-01 08:17:46 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:55:25 -0500 |
commit | 9fa896429905eccc263ff0d5e592ecaf651af12d (patch) | |
tree | 310374164f56cb624e4bcbad976a0dfae2918e2a /net/ipv4/devinet.c | |
parent | c3bac5a71b24f6ed892b250d4f7511cedc33d34c (diff) |
[IPV4]: Cleanup the devinet_sysctl_register
I moved the call to kmalloc() from the *t declaration into
the code (this is confusing when a variable is initialized
with the result of some call) and removed unneeded comment
near the error path. Just like I did with the neigh ctl-s.
Besides, I fixed the goto's and the labels - they were indented
with spaces :(
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/devinet.c')
-rw-r--r-- | net/ipv4/devinet.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 6e75c884e1af..72dd0ecb1081 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
@@ -1506,12 +1506,13 @@ static void devinet_sysctl_register(struct in_device *in_dev, | |||
1506 | { | 1506 | { |
1507 | int i; | 1507 | int i; |
1508 | struct net_device *dev = in_dev ? in_dev->dev : NULL; | 1508 | struct net_device *dev = in_dev ? in_dev->dev : NULL; |
1509 | struct devinet_sysctl_table *t = kmemdup(&devinet_sysctl, sizeof(*t), | 1509 | struct devinet_sysctl_table *t; |
1510 | GFP_KERNEL); | ||
1511 | char *dev_name = NULL; | 1510 | char *dev_name = NULL; |
1512 | 1511 | ||
1512 | t = kmemdup(&devinet_sysctl, sizeof(*t), GFP_KERNEL); | ||
1513 | if (!t) | 1513 | if (!t) |
1514 | return; | 1514 | goto out; |
1515 | |||
1515 | for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) { | 1516 | for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) { |
1516 | t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf; | 1517 | t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf; |
1517 | t->devinet_vars[i].extra1 = p; | 1518 | t->devinet_vars[i].extra1 = p; |
@@ -1532,7 +1533,7 @@ static void devinet_sysctl_register(struct in_device *in_dev, | |||
1532 | */ | 1533 | */ |
1533 | dev_name = kstrdup(dev_name, GFP_KERNEL); | 1534 | dev_name = kstrdup(dev_name, GFP_KERNEL); |
1534 | if (!dev_name) | 1535 | if (!dev_name) |
1535 | goto free; | 1536 | goto free; |
1536 | 1537 | ||
1537 | t->devinet_dev[0].procname = dev_name; | 1538 | t->devinet_dev[0].procname = dev_name; |
1538 | t->devinet_dev[0].child = t->devinet_vars; | 1539 | t->devinet_dev[0].child = t->devinet_vars; |
@@ -1542,16 +1543,16 @@ static void devinet_sysctl_register(struct in_device *in_dev, | |||
1542 | 1543 | ||
1543 | t->sysctl_header = register_sysctl_table(t->devinet_root_dir); | 1544 | t->sysctl_header = register_sysctl_table(t->devinet_root_dir); |
1544 | if (!t->sysctl_header) | 1545 | if (!t->sysctl_header) |
1545 | goto free_procname; | 1546 | goto free_procname; |
1546 | 1547 | ||
1547 | p->sysctl = t; | 1548 | p->sysctl = t; |
1548 | return; | 1549 | return; |
1549 | 1550 | ||
1550 | /* error path */ | 1551 | free_procname: |
1551 | free_procname: | ||
1552 | kfree(dev_name); | 1552 | kfree(dev_name); |
1553 | free: | 1553 | free: |
1554 | kfree(t); | 1554 | kfree(t); |
1555 | out: | ||
1555 | return; | 1556 | return; |
1556 | } | 1557 | } |
1557 | 1558 | ||