]> err.no Git - linux-2.6/commitdiff
[ARP]: Remove overkill checks from neigh_param_alloc.
authorDenis V. Lunev <den@openvz.org>
Tue, 15 Jan 2008 06:59:59 +0000 (22:59 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 28 Jan 2008 23:02:10 +0000 (15:02 -0800)
Valid network device is always passed into neigh_param_alloc, so
remove extra checking for dev == NULL. Additionally, cleanup bogus
netns assignment.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/neighbour.c

index 19c0dd12fd58462b42bd7c3edf0decca1832975f..62d47841c67da09f6c641158e049baa0b3c24e84 100644 (file)
@@ -1291,10 +1291,7 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
        struct neigh_parms *p, *ref;
        struct net *net;
 
-       net = &init_net;
-       if (dev)
-               net = dev->nd_net;
-
+       net = dev->nd_net;
        ref = lookup_neigh_params(tbl, net, 0);
        if (!ref)
                return NULL;
@@ -1306,15 +1303,14 @@ struct neigh_parms *neigh_parms_alloc(struct net_device *dev,
                INIT_RCU_HEAD(&p->rcu_head);
                p->reachable_time =
                                neigh_rand_reach_time(p->base_reachable_time);
-               if (dev) {
-                       if (dev->neigh_setup && dev->neigh_setup(dev, p)) {
-                               kfree(p);
-                               return NULL;
-                       }
 
-                       dev_hold(dev);
-                       p->dev = dev;
+               if (dev->neigh_setup && dev->neigh_setup(dev, p)) {
+                       kfree(p);
+                       return NULL;
                }
+
+               dev_hold(dev);
+               p->dev = dev;
                p->net = hold_net(net);
                p->sysctl_table = NULL;
                write_lock_bh(&tbl->lock);