diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c index e4401a531afb..d9a9b0fc1795 100644 --- a/net/bridge/br_device.c +++ b/net/bridge/br_device.c @@ -226,37 +226,11 @@ static void br_netpoll_cleanup(struct net_device *dev) br_netpoll_disable(p); } -static int br_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, - gfp_t gfp) -{ - struct net_bridge *br = netdev_priv(dev); - struct net_bridge_port *p; - int err = 0; - - list_for_each_entry(p, &br->port_list, list) { - if (!p->dev) - continue; - err = br_netpoll_enable(p, gfp); - if (err) - goto fail; - } - -out: - return err; - -fail: - br_netpoll_cleanup(dev); - goto out; -} - -int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp) +static int __br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp) { struct netpoll *np; int err; - if (!p->br->dev->npinfo) - return 0; - np = kzalloc(sizeof(*p->np), gfp); if (!np) return -ENOMEM; @@ -271,6 +245,37 @@ int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp) return err; } +int br_netpoll_enable(struct net_bridge_port *p, gfp_t gfp) +{ + if (!p->br->dev->npinfo) + return 0; + + return __br_netpoll_enable(p, gfp); +} + +static int br_netpoll_setup(struct net_device *dev, struct netpoll_info *ni, + gfp_t gfp) +{ + struct net_bridge *br = netdev_priv(dev); + struct net_bridge_port *p; + int err = 0; + + list_for_each_entry(p, &br->port_list, list) { + if (!p->dev) + continue; + err = __br_netpoll_enable(p, gfp); + if (err) + goto fail; + } + +out: + return err; + +fail: + br_netpoll_cleanup(dev); + goto out; +} + void br_netpoll_disable(struct net_bridge_port *p) { struct netpoll *np = p->np;