Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: linux-mediatek@lists.infradead.org
Subject: [bug report] wifi: mt76: mt7996: Add NPU offload support to MT7996 driver
Date: Thu, 21 May 2026 15:51:58 +0300	[thread overview]
Message-ID: <ag7_7qsgKZdAfFjA@stanley.mountain> (raw)

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


                 reply	other threads:[~2026-05-21 12:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ag7_7qsgKZdAfFjA@stanley.mountain \
    --to=error27@gmail.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=lorenzo@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox