diff options
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 44 |
1 files changed, 13 insertions, 31 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 63369b6b14d4..74824028f85c 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -2213,33 +2213,24 @@ static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *in | |||
2213 | { | 2213 | { |
2214 | struct bonding *bond = netdev_priv(bond_dev); | 2214 | struct bonding *bond = netdev_priv(bond_dev); |
2215 | struct slave *slave; | 2215 | struct slave *slave; |
2216 | int i, found = 0; | 2216 | int i, res = -ENODEV; |
2217 | |||
2218 | if (info->slave_id < 0) { | ||
2219 | return -ENODEV; | ||
2220 | } | ||
2221 | 2217 | ||
2222 | read_lock(&bond->lock); | 2218 | read_lock(&bond->lock); |
2223 | 2219 | ||
2224 | bond_for_each_slave(bond, slave, i) { | 2220 | bond_for_each_slave(bond, slave, i) { |
2225 | if (i == (int)info->slave_id) { | 2221 | if (i == (int)info->slave_id) { |
2226 | found = 1; | 2222 | res = 0; |
2223 | strcpy(info->slave_name, slave->dev->name); | ||
2224 | info->link = slave->link; | ||
2225 | info->state = slave->state; | ||
2226 | info->link_failure_count = slave->link_failure_count; | ||
2227 | break; | 2227 | break; |
2228 | } | 2228 | } |
2229 | } | 2229 | } |
2230 | 2230 | ||
2231 | read_unlock(&bond->lock); | 2231 | read_unlock(&bond->lock); |
2232 | 2232 | ||
2233 | if (found) { | 2233 | return res; |
2234 | strcpy(info->slave_name, slave->dev->name); | ||
2235 | info->link = slave->link; | ||
2236 | info->state = slave->state; | ||
2237 | info->link_failure_count = slave->link_failure_count; | ||
2238 | } else { | ||
2239 | return -ENODEV; | ||
2240 | } | ||
2241 | |||
2242 | return 0; | ||
2243 | } | 2234 | } |
2244 | 2235 | ||
2245 | /*-------------------------------- Monitoring -------------------------------*/ | 2236 | /*-------------------------------- Monitoring -------------------------------*/ |
@@ -5167,16 +5158,15 @@ int bond_create(char *name, struct bond_params *params) | |||
5167 | up_write(&bonding_rwsem); | 5158 | up_write(&bonding_rwsem); |
5168 | rtnl_unlock(); /* allows sysfs registration of net device */ | 5159 | rtnl_unlock(); /* allows sysfs registration of net device */ |
5169 | res = bond_create_sysfs_entry(netdev_priv(bond_dev)); | 5160 | res = bond_create_sysfs_entry(netdev_priv(bond_dev)); |
5170 | if (res < 0) { | 5161 | if (res < 0) |
5171 | rtnl_lock(); | 5162 | goto out_unreg; |
5172 | down_write(&bonding_rwsem); | ||
5173 | bond_deinit(bond_dev); | ||
5174 | unregister_netdevice(bond_dev); | ||
5175 | goto out_rtnl; | ||
5176 | } | ||
5177 | 5163 | ||
5178 | return 0; | 5164 | return 0; |
5179 | 5165 | ||
5166 | out_unreg: | ||
5167 | rtnl_lock(); | ||
5168 | down_write(&bonding_rwsem); | ||
5169 | unregister_netdevice(bond_dev); | ||
5180 | out_bond: | 5170 | out_bond: |
5181 | bond_deinit(bond_dev); | 5171 | bond_deinit(bond_dev); |
5182 | out_netdev: | 5172 | out_netdev: |
@@ -5191,7 +5181,6 @@ static int __init bonding_init(void) | |||
5191 | { | 5181 | { |
5192 | int i; | 5182 | int i; |
5193 | int res; | 5183 | int res; |
5194 | struct bonding *bond; | ||
5195 | 5184 | ||
5196 | printk(KERN_INFO "%s", version); | 5185 | printk(KERN_INFO "%s", version); |
5197 | 5186 | ||
@@ -5222,13 +5211,6 @@ static int __init bonding_init(void) | |||
5222 | 5211 | ||
5223 | goto out; | 5212 | goto out; |
5224 | err: | 5213 | err: |
5225 | list_for_each_entry(bond, &bond_dev_list, bond_list) { | ||
5226 | bond_work_cancel_all(bond); | ||
5227 | destroy_workqueue(bond->wq); | ||
5228 | } | ||
5229 | |||
5230 | bond_destroy_sysfs(); | ||
5231 | |||
5232 | rtnl_lock(); | 5214 | rtnl_lock(); |
5233 | bond_free_all(); | 5215 | bond_free_all(); |
5234 | rtnl_unlock(); | 5216 | rtnl_unlock(); |