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>
This commit is contained in:
parent
3e2a5e1539
commit
1e2a8868e0
|
@ -1379,8 +1379,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
|
||||||
if (slave_dev->flags & IFF_UP) {
|
if (slave_dev->flags & IFF_UP) {
|
||||||
netdev_err(bond_dev, "%s is up - this may be due to an out of date ifenslave\n",
|
netdev_err(bond_dev, "%s is up - this may be due to an out of date ifenslave\n",
|
||||||
slave_dev->name);
|
slave_dev->name);
|
||||||
res = -EPERM;
|
return -EPERM;
|
||||||
goto err_undo_flags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set bonding device ether type by slave - bonding netdevices are
|
/* 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)
|
||||||
res = notifier_to_errno(res);
|
res = notifier_to_errno(res);
|
||||||
if (res) {
|
if (res) {
|
||||||
netdev_err(bond_dev, "refused to change device type\n");
|
netdev_err(bond_dev, "refused to change device type\n");
|
||||||
res = -EBUSY;
|
return -EBUSY;
|
||||||
goto err_undo_flags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flush unicast and multicast addresses */
|
/* Flush unicast and multicast addresses */
|
||||||
|
@ -1421,8 +1419,7 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
|
||||||
} else if (bond_dev->type != slave_dev->type) {
|
} else if (bond_dev->type != slave_dev->type) {
|
||||||
netdev_err(bond_dev, "%s ether type (%d) is different from other slaves (%d), can not enslave it\n",
|
netdev_err(bond_dev, "%s ether type (%d) is different from other slaves (%d), can not enslave it\n",
|
||||||
slave_dev->name, slave_dev->type, bond_dev->type);
|
slave_dev->name, slave_dev->type, bond_dev->type);
|
||||||
res = -EINVAL;
|
return -EINVAL;
|
||||||
goto err_undo_flags;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (slave_ops->ndo_set_mac_address == NULL) {
|
if (slave_ops->ndo_set_mac_address == NULL) {
|
||||||
|
|
Loading…
Reference in New Issue