Search Linux Wireless

[PATCH 2/5] mt76: rework dma.c to adapt mt7986 changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Bo Jiao <Bo.Jiao@xxxxxxxxxxxx>

Check ndesc of q_rx to avoid potential hole in iteration.
This is an intermediate patch to add mt7986 support.

Signed-off-by: Sujuan Chen <sujuan.chen@xxxxxxxxxxxx>
Signed-off-by: Bo Jiao <Bo.Jiao@xxxxxxxxxxxx>
Reviewed-by: Ryder Lee <ryder.lee@xxxxxxxxxxxx>
---
 drivers/net/wireless/mediatek/mt76/dma.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/dma.c b/drivers/net/wireless/mediatek/mt76/dma.c
index fd4c51b..83f045a 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/dma.c
@@ -660,10 +660,12 @@ mt76_dma_init(struct mt76_dev *dev,
 		 wiphy_name(dev->hw->wiphy));
 	dev->napi_dev.threaded = 1;
 
-	mt76_for_each_q_rx(dev, i) {
-		netif_napi_add(&dev->napi_dev, &dev->napi[i], poll, 64);
-		mt76_dma_rx_fill(dev, &dev->q_rx[i]);
-		napi_enable(&dev->napi[i]);
+	for (i = 0; i < ARRAY_SIZE(dev->q_rx); i++) {
+		if (dev->q_rx[i].ndesc) {
+			netif_napi_add(&dev->napi_dev, &dev->napi[i], poll, 64);
+			mt76_dma_rx_fill(dev, &dev->q_rx[i]);
+			napi_enable(&dev->napi[i]);
+		}
 	}
 
 	return 0;
-- 
2.18.0




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux