Commit 15df5e71 authored by Nikolay Aleksandrov's avatar Nikolay Aleksandrov Committed by David S. Miller

vrf: move vrf_insert_slave so we can drop a goto label

We can simplify do_vrf_add_slave by moving vrf_insert_slave in the end
of the enslaving and thus eliminate an error goto label. It always
succeeds and isn't needed before that anyway.
Signed-off-by: default avatarNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 67f3a90b
...@@ -363,15 +363,13 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev) ...@@ -363,15 +363,13 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
vrf_ptr->ifindex = dev->ifindex; vrf_ptr->ifindex = dev->ifindex;
vrf_ptr->tb_id = vrf->tb_id; vrf_ptr->tb_id = vrf->tb_id;
__vrf_insert_slave(queue, slave);
/* register the packet handler for slave ports */ /* register the packet handler for slave ports */
ret = netdev_rx_handler_register(port_dev, vrf_handle_frame, dev); ret = netdev_rx_handler_register(port_dev, vrf_handle_frame, dev);
if (ret) { if (ret) {
netdev_err(port_dev, netdev_err(port_dev,
"Device %s failed to register rx_handler\n", "Device %s failed to register rx_handler\n",
port_dev->name); port_dev->name);
goto out_remove; goto out_fail;
} }
ret = netdev_master_upper_dev_link(port_dev, dev); ret = netdev_master_upper_dev_link(port_dev, dev);
...@@ -379,7 +377,7 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev) ...@@ -379,7 +377,7 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
goto out_unregister; goto out_unregister;
port_dev->flags |= IFF_SLAVE; port_dev->flags |= IFF_SLAVE;
__vrf_insert_slave(queue, slave);
rcu_assign_pointer(port_dev->vrf_ptr, vrf_ptr); rcu_assign_pointer(port_dev->vrf_ptr, vrf_ptr);
cycle_netdev(port_dev); cycle_netdev(port_dev);
...@@ -387,8 +385,6 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev) ...@@ -387,8 +385,6 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
out_unregister: out_unregister:
netdev_rx_handler_unregister(port_dev); netdev_rx_handler_unregister(port_dev);
out_remove:
__vrf_remove_slave(queue, slave);
out_fail: out_fail:
kfree(vrf_ptr); kfree(vrf_ptr);
kfree(slave); kfree(slave);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment