[bug report] wifi: mt76: mt7996: Add NPU offload support to MT7996 driver

Dan Carpenter error27 at gmail.com
Thu May 21 05:51:58 PDT 2026


Hello Lorenzo Bianconi,

Commit 377aa17d2aed ("wifi: mt76: mt7996: Add NPU offload support to
MT7996 driver") from Oct 17, 2025, leads to the following Smatch
complaint:

    drivers/net/wireless/mediatek/mt76/mt7996/pci.c:144 mt7996_pci_probe()
    warn: variable dereferenced before check 'pdev->bus' (see line 126)

drivers/net/wireless/mediatek/mt76/mt7996/pci.c
   125	
   126		mt76_pci_disable_aspm(pdev);
                                      ^^^^
This dereferences pdev->bus so...

   127	
   128		if (id->device == MT7996_DEVICE_ID_2 ||
   129		    id->device == MT7992_DEVICE_ID_2 ||
   130		    id->device == MT7990_DEVICE_ID_2)
   131			return mt7996_pci_hif2_probe(pdev);
   132	
   133		dev = mt7996_mmio_probe(&pdev->dev, pcim_iomap_table(pdev)[0],
   134					id->device);
   135		if (IS_ERR(dev))
   136			return PTR_ERR(dev);
   137	
   138		mdev = &dev->mt76;
   139		mt7996_wfsys_reset(dev);
   140		hif2 = mt7996_pci_init_hif2(pdev);
   141		dev->hif2 = hif2;
   142	
   143		mt76_npu_init(mdev, pci_resource_start(pdev, 0),
   144			      pdev->bus && pci_domain_nr(pdev->bus) ? 3 : 2);
                              ^^^^^^^^^
so hopefully this check can be removed?

(Proably this warning is showing up seven months later because I
deleted my cross function database.  Probably Smatch wasn't
complaining before because it knew that ->bus couldn't actually be
NULL?)

   145	
   146		ret = mt7996_mmio_wed_init(dev, pdev, false, &irq);

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

regards,
dan carpenter



More information about the Linux-mediatek mailing list