On 2022-01-11 08:51, Bo Jiao wrote:
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) {
Please fix mt76_for_each_q_rx instead. You can simply define it to
for (i = 0; i < ARRAY_SIZE((dev)->q_rx); i++) \
if ((dev)->q_rx[i].ndesc)
Thanks,
- Felix