diff options
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index 63369b6b14d4..67515b78ff91 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 -------------------------------*/ |