summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLorenzo Bianconi <lorenzo@kernel.org>2021-02-24 12:29:34 +0100
committerFelix Fietkau <nbd@nbd.name>2021-04-12 00:01:22 +0200
commit57b8b57516c5108b0078051a31c68dc9dfcbf68f (patch)
tree5ad8356d7dac4de67463c6a01dfb7230bbed1d0b /drivers
parentc996f0346e40e3b1ac2ebaf0681df898fb157f60 (diff)
mt76: check return value of mt76_txq_send_burst in mt76_txq_schedule_list
Since mt76_txq_send_burst routine can report a negative error code, check the returned value before incrementing the number of transmitted frames in mt76_txq_schedule_list routine. Return -EBUSY directly if the device is in reset or in power management. Fixes: 90fdc1717b186 ("mt76: use mac80211 txq scheduling") Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/mediatek/mt76/tx.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/tx.c b/drivers/net/wireless/mediatek/mt76/tx.c
index b8fe8adc43a3..451ed60c6296 100644
--- a/drivers/net/wireless/mediatek/mt76/tx.c
+++ b/drivers/net/wireless/mediatek/mt76/tx.c
@@ -461,11 +461,11 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid)
int ret = 0;
while (1) {
+ int n_frames = 0;
+
if (test_bit(MT76_STATE_PM, &phy->state) ||
- test_bit(MT76_RESET, &phy->state)) {
- ret = -EBUSY;
- break;
- }
+ test_bit(MT76_RESET, &phy->state))
+ return -EBUSY;
if (dev->queue_ops->tx_cleanup &&
q->queued + 2 * MT_TXQ_FREE_THR >= q->ndesc) {
@@ -497,11 +497,16 @@ mt76_txq_schedule_list(struct mt76_phy *phy, enum mt76_txq_id qid)
}
if (!mt76_txq_stopped(q))
- ret += mt76_txq_send_burst(phy, q, mtxq);
+ n_frames = mt76_txq_send_burst(phy, q, mtxq);
spin_unlock_bh(&q->lock);
ieee80211_return_txq(phy->hw, txq, false);
+
+ if (unlikely(n_frames < 0))
+ return n_frames;
+
+ ret += n_frames;
}
return ret;