[bug report] wifi: mt76: mt7996: Integrate MT7990 dma configuration for NPU

Dan Carpenter
2026-04-10T10:13:53Z

Hello Lorenzo Bianconi,

Commit cd7951f242a7 ("wifi: mt76: mt7996: Integrate MT7990 dma
configuration for NPU") from Jan 22, 2026 (linux-next), leads to the
following Smatch static checker warning:

drivers/net/wireless/mediatek/mt76/mt7996/dma.c:683 mt7996_dma_init()
error: NULL dereference inside function mt7996_init_tx_queues()

drivers/net/wireless/mediatek/mt76/mt7996/dma.c
664 int mt7996_dma_init(struct mt7996_dev *dev)
665 {
666 struct mtk_wed_device *wed = &dev->mt76.mmio.wed;
667 struct mtk_wed_device *wed_hif2 = &dev->mt76.mmio.wed_hif2;
668 u32 rx_base;
669 u32 hif1_ofs = 0;
670 int ret;
671
672 mt7996_dma_config(dev);
673
674 mt76_dma_attach(&dev->mt76);
675
676 if (dev->hif2)
677 hif1_ofs = MT_WFDMA0_PCIE1(0) - MT_WFDMA0(0);
678
679 mt7996_dma_disable(dev, true);
680
681 /* init tx queue */
682 if (is_mt7996(&dev->mt76) && mt76_npu_device_active(&dev->mt76))
--> 683 ret = mt7996_init_tx_queues(&dev->phy, MT_TXQ_ID(0),
684 MT7996_NPU_TX_RING_SIZE,
685 MT_TXQ_RING_BASE(0) + hif1_ofs,
686 NULL);
^^^^
Can't pass NULL here. It leads to a crash. Use wed?

687 else
688 ret = mt7996_init_tx_queues(&dev->phy,
689 MT_TXQ_ID(dev->mphy.band_idx),
690 MT7996_TX_RING_SIZE,
691 MT_TXQ_RING_BASE(0), wed);
692 if (ret)
693 return ret;
694

This email is a free service from the Smatch-CI project [smatch.sf.net].

regards,
dan carpenter