[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>
This commit is contained in:
committed by
David S. Miller
parent
c3bac5a71b
commit
9fa8964299
@@ -1506,12 +1506,13 @@ static void devinet_sysctl_register(struct in_device *in_dev,
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct net_device *dev = in_dev ? in_dev->dev : NULL;
|
struct net_device *dev = in_dev ? in_dev->dev : NULL;
|
||||||
struct devinet_sysctl_table *t = kmemdup(&devinet_sysctl, sizeof(*t),
|
struct devinet_sysctl_table *t;
|
||||||
GFP_KERNEL);
|
|
||||||
char *dev_name = NULL;
|
char *dev_name = NULL;
|
||||||
|
|
||||||
|
t = kmemdup(&devinet_sysctl, sizeof(*t), GFP_KERNEL);
|
||||||
if (!t)
|
if (!t)
|
||||||
return;
|
goto out;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) {
|
for (i = 0; i < ARRAY_SIZE(t->devinet_vars) - 1; i++) {
|
||||||
t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf;
|
t->devinet_vars[i].data += (char *)p - (char *)&ipv4_devconf;
|
||||||
t->devinet_vars[i].extra1 = p;
|
t->devinet_vars[i].extra1 = p;
|
||||||
@@ -1547,11 +1548,11 @@ static void devinet_sysctl_register(struct in_device *in_dev,
|
|||||||
p->sysctl = t;
|
p->sysctl = t;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* error path */
|
free_procname:
|
||||||
free_procname:
|
|
||||||
kfree(dev_name);
|
kfree(dev_name);
|
||||||
free:
|
free:
|
||||||
kfree(t);
|
kfree(t);
|
||||||
|
out:
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user