bridge: cleanup netpoll code
authorstephen hemminger <stephen@networkplumber.org>
Wed, 24 Jul 2013 18:51:41 +0000 (11:51 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 26 Jul 2013 22:24:32 +0000 (15:24 -0700)
This started out with fixing a sparse warning, then I realized that
the wrapper function br_netpoll_info could just be collapsed away
by rolling it into the enable code.

Also, eliminate unnecessary goto's

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Jiri Pirko <jiri@resnulli.us>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_device.c
net/bridge/br_if.c
net/bridge/br_private.h

index 2ef66781fedb3a9211448fa3db73eedab2c7d8a2..50d86b3e3941f948e0e36a2a1480e06a37b824b4 100644 (file)
@@ -244,22 +244,22 @@ fail:
 int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp)
 {
        struct netpoll *np;
-       int err = 0;
+       int err;
+
+       if (!p->br->dev->npinfo)
+               return 0;
 
        np = kzalloc(sizeof(*p->np), gfp);
-       err = -ENOMEM;
        if (!np)
-               goto out;
+               return -ENOMEM;
 
        err = __netpoll_setup(np, p->dev, gfp);
        if (err) {
                kfree(np);
-               goto out;
+               return err;
        }
 
        p->np = np;
-
-out:
        return err;
 }
 
index 5623be6b9ecda3f77d62cb2db7fc5e9aef2bd65c..aa6c9a8ba32a8df827e0749c6c4f870f6c3f2362 100644 (file)
@@ -363,7 +363,8 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
        if (err)
                goto err2;
 
-       if (br_netpoll_info(br) && ((err = br_netpoll_enable(p, GFP_KERNEL))))
+       err = br_netpoll_enable(p, GFP_KERNEL);
+       if (err)
                goto err3;
 
        err = netdev_master_upper_dev_link(dev, br->dev);
index 3be89b3ce17b5a314215609790cadec6e5453727..43347f1299433383fd612eb5b3d7742325e843bf 100644 (file)
@@ -333,11 +333,6 @@ extern void br_dev_delete(struct net_device *dev, struct list_head *list);
 extern netdev_tx_t br_dev_xmit(struct sk_buff *skb,
                               struct net_device *dev);
 #ifdef CONFIG_NET_POLL_CONTROLLER
-static inline struct netpoll_info *br_netpoll_info(struct net_bridge *br)
-{
-       return br->dev->npinfo;
-}
-
 static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
                                       struct sk_buff *skb)
 {
@@ -350,11 +345,6 @@ static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
 extern int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp);
 extern void br_netpoll_disable(struct net_bridge_port *p);
 #else
-static inline struct netpoll_info *br_netpoll_info(struct net_bridge *br)
-{
-       return NULL;
-}
-
 static inline void br_netpoll_send_skb(const struct net_bridge_port *p,
                                       struct sk_buff *skb)
 {