diff options
author | Zhang Shengju <zhangshengju@cmss.chinamobile.com> | 2016-02-09 05:37:46 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-02-11 09:57:00 -0500 |
commit | 1e2a8868e0541b7d8870781b714d74ac7cad9a6a (patch) | |
tree | 4bf88800643ec885813d06a6d15fc5c66c3ce80f /drivers/net/bonding | |
parent | 3e2a5e1539064329f5f6888274600841ad6f87bd (diff) |
bonding: use return instead of goto
Replace 'goto' with 'return' to remove unnecessary check at label:
err_undo_flags.
The reason is that 'err_undo_flags' do two things for the first slave device:
1.revert bond mac address if it is set by the slave device.
2.revert bond device type if it's not ARPHRD_ETHER.
It's not necessary for the following three places, they changed neither bond
mac address nor type. It's straightforward to return directly.
Signed-off-by: Zhang Shengju <zhangshengju@cmss.chinamobile.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 705cb0198faa..45bdd87d6b7a 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -1379,8 +1379,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1379 | if (slave_dev->flags & IFF_UP) { | 1379 | if (slave_dev->flags & IFF_UP) { |
1380 | netdev_err(bond_dev, "%s is up - this may be due to an out of date ifenslave\n", | 1380 | netdev_err(bond_dev, "%s is up - this may be due to an out of date ifenslave\n", |
1381 | slave_dev->name); | 1381 | slave_dev->name); |
1382 | res = -EPERM; | 1382 | return -EPERM; |
1383 | goto err_undo_flags; | ||
1384 | } | 1383 | } |
1385 | 1384 | ||
1386 | /* set bonding device ether type by slave - bonding netdevices are | 1385 | /* set bonding device ether type by slave - bonding netdevices are |
@@ -1400,8 +1399,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1400 | res = notifier_to_errno(res); | 1399 | res = notifier_to_errno(res); |
1401 | if (res) { | 1400 | if (res) { |
1402 | netdev_err(bond_dev, "refused to change device type\n"); | 1401 | netdev_err(bond_dev, "refused to change device type\n"); |
1403 | res = -EBUSY; | 1402 | return -EBUSY; |
1404 | goto err_undo_flags; | ||
1405 | } | 1403 | } |
1406 | 1404 | ||
1407 | /* Flush unicast and multicast addresses */ | 1405 | /* Flush unicast and multicast addresses */ |
@@ -1421,8 +1419,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) | |||
1421 | } else if (bond_dev->type != slave_dev->type) { | 1419 | } else if (bond_dev->type != slave_dev->type) { |
1422 | netdev_err(bond_dev, "%s ether type (%d) is different from other slaves (%d), can not enslave it\n", | 1420 | netdev_err(bond_dev, "%s ether type (%d) is different from other slaves (%d), can not enslave it\n", |
1423 | slave_dev->name, slave_dev->type, bond_dev->type); | 1421 | slave_dev->name, slave_dev->type, bond_dev->type); |
1424 | res = -EINVAL; | 1422 | return -EINVAL; |
1425 | goto err_undo_flags; | ||
1426 | } | 1423 | } |
1427 | 1424 | ||
1428 | if (slave_ops->ndo_set_mac_address == NULL) { | 1425 | if (slave_ops->ndo_set_mac_address == NULL) { |