aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bonding/bond_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r--drivers/net/bonding/bond_main.c36
1 files changed, 13 insertions, 23 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index fd738367d740..e3af662b0559 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -2211,33 +2211,24 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in
2211{ 2211{
2212 struct bonding *bond = netdev_priv(bond_dev); 2212 struct bonding *bond = netdev_priv(bond_dev);
2213 struct slave *slave; 2213 struct slave *slave;
2214 int i, found = 0; 2214 int i, res = -ENODEV;
2215
2216 if (info->slave_id < 0) {
2217 return -ENODEV;
2218 }
2219 2215
2220 read_lock(&bond->lock); 2216 read_lock(&bond->lock);
2221 2217
2222 bond_for_each_slave(bond, slave, i) { 2218 bond_for_each_slave(bond, slave, i) {
2223 if (i == (int)info->slave_id) { 2219 if (i == (int)info->slave_id) {
2224 found = 1; 2220 res = 0;
2221 strcpy(info->slave_name, slave->dev->name);
2222 info->link = slave->link;
2223 info->state = slave->state;
2224 info->link_failure_count = slave->link_failure_count;
2225 break; 2225 break;
2226 } 2226 }
2227 } 2227 }
2228 2228
2229 read_unlock(&bond->lock); 2229 read_unlock(&bond->lock);
2230 2230
2231 if (found) { 2231 return res;
2232 strcpy(info->slave_name, slave->dev->name);
2233 info->link = slave->link;
2234 info->state = slave->state;
2235 info->link_failure_count = slave->link_failure_count;
2236 } else {
2237 return -ENODEV;
2238 }
2239
2240 return 0;
2241} 2232}
2242 2233
2243/*-------------------------------- Monitoring -------------------------------*/ 2234/*-------------------------------- Monitoring -------------------------------*/
@@ -5173,16 +5164,15 @@ int bond_create(char *name, struct bond_params *params)
5173 up_write(&bonding_rwsem); 5164 up_write(&bonding_rwsem);
5174 rtnl_unlock(); /* allows sysfs registration of net device */ 5165 rtnl_unlock(); /* allows sysfs registration of net device */
5175 res = bond_create_sysfs_entry(netdev_priv(bond_dev)); 5166 res = bond_create_sysfs_entry(netdev_priv(bond_dev));
5176 if (res < 0) { 5167 if (res < 0)
5177 rtnl_lock(); 5168 goto out_unreg;
5178 down_write(&bonding_rwsem);
5179 bond_deinit(bond_dev);
5180 unregister_netdevice(bond_dev);
5181 goto out_rtnl;
5182 }
5183 5169
5184 return 0; 5170 return 0;
5185 5171
5172out_unreg:
5173 rtnl_lock();
5174 down_write(&bonding_rwsem);
5175 unregister_netdevice(bond_dev);
5186out_bond: 5176out_bond:
5187 bond_deinit(bond_dev); 5177 bond_deinit(bond_dev);
5188out_netdev: 5178out_netdev: