Commit 14a59e18 authored by Loic Le Loarer's avatar Loic Le Loarer Committed by David S. Miller

[EQL]: Proper num_slaves decrement

Signed-off-by: default avatarLoic Le Loarer <loic.le-loarer+lk@polytechnique.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4acdbdbe
...@@ -132,7 +132,7 @@ static struct net_device_stats *eql_get_stats(struct net_device *dev); ...@@ -132,7 +132,7 @@ static struct net_device_stats *eql_get_stats(struct net_device *dev);
#define eql_is_slave(dev) ((dev->flags & IFF_SLAVE) == IFF_SLAVE) #define eql_is_slave(dev) ((dev->flags & IFF_SLAVE) == IFF_SLAVE)
#define eql_is_master(dev) ((dev->flags & IFF_MASTER) == IFF_MASTER) #define eql_is_master(dev) ((dev->flags & IFF_MASTER) == IFF_MASTER)
static void eql_kill_one_slave(slave_t *slave); static void eql_kill_one_slave(slave_queue_t *queue, slave_t *slave);
static void eql_timer(unsigned long param) static void eql_timer(unsigned long param)
{ {
...@@ -149,7 +149,7 @@ static void eql_timer(unsigned long param) ...@@ -149,7 +149,7 @@ static void eql_timer(unsigned long param)
if (slave->bytes_queued < 0) if (slave->bytes_queued < 0)
slave->bytes_queued = 0; slave->bytes_queued = 0;
} else { } else {
eql_kill_one_slave(slave); eql_kill_one_slave(&eql->queue, slave);
} }
} }
...@@ -214,9 +214,10 @@ static int eql_open(struct net_device *dev) ...@@ -214,9 +214,10 @@ static int eql_open(struct net_device *dev)
return 0; return 0;
} }
static void eql_kill_one_slave(slave_t *slave) static void eql_kill_one_slave(slave_queue_t *queue, slave_t *slave)
{ {
list_del(&slave->list); list_del(&slave->list);
queue->num_slaves--;
slave->dev->flags &= ~IFF_SLAVE; slave->dev->flags &= ~IFF_SLAVE;
dev_put(slave->dev); dev_put(slave->dev);
kfree(slave); kfree(slave);
...@@ -232,8 +233,7 @@ static void eql_kill_slave_queue(slave_queue_t *queue) ...@@ -232,8 +233,7 @@ static void eql_kill_slave_queue(slave_queue_t *queue)
list_for_each_safe(this, tmp, head) { list_for_each_safe(this, tmp, head) {
slave_t *s = list_entry(this, slave_t, list); slave_t *s = list_entry(this, slave_t, list);
eql_kill_one_slave(s); eql_kill_one_slave(queue, s);
queue->num_slaves--;
} }
spin_unlock_bh(&queue->lock); spin_unlock_bh(&queue->lock);
...@@ -318,7 +318,7 @@ static slave_t *__eql_schedule_slaves(slave_queue_t *queue) ...@@ -318,7 +318,7 @@ static slave_t *__eql_schedule_slaves(slave_queue_t *queue)
} }
} else { } else {
/* We found a dead slave, kill it. */ /* We found a dead slave, kill it. */
eql_kill_one_slave(slave); eql_kill_one_slave(queue, slave);
} }
} }
return best_slave; return best_slave;
...@@ -393,7 +393,7 @@ static int __eql_insert_slave(slave_queue_t *queue, slave_t *slave) ...@@ -393,7 +393,7 @@ static int __eql_insert_slave(slave_queue_t *queue, slave_t *slave)
duplicate_slave = __eql_find_slave_dev(queue, slave->dev); duplicate_slave = __eql_find_slave_dev(queue, slave->dev);
if (duplicate_slave != 0) if (duplicate_slave != 0)
eql_kill_one_slave(duplicate_slave); eql_kill_one_slave(queue, duplicate_slave);
list_add(&slave->list, &queue->all_slaves); list_add(&slave->list, &queue->all_slaves);
queue->num_slaves++; queue->num_slaves++;
...@@ -471,7 +471,7 @@ static int eql_emancipate(struct net_device *master_dev, slaving_request_t __use ...@@ -471,7 +471,7 @@ static int eql_emancipate(struct net_device *master_dev, slaving_request_t __use
slave_dev); slave_dev);
if (slave) { if (slave) {
eql_kill_one_slave(slave); eql_kill_one_slave(&eql->queue, slave);
ret = 0; ret = 0;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment