wifi: mt76: mt7921: fix uninitialized variable warning

Move the initialization of 'dev' before the error path that uses it.
This fixes the compiler warning:
  drivers/net/wireless/mediatek/mt76/mt7921/pci.c:347:6: warning:
  variable 'dev' is used uninitialized whenever 'if' condition is true

Fixes: 0d56655a74ef ("wifi: mt76: mt7921: fix resource leak in probe error path")
Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Hongling Zeng <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Hongling Zeng
2026-05-27 13:21:31 +02:00
committed by Felix Fietkau
parent fe0555feb3
commit 97fc0e785d
+2 -1
View File
@@ -343,13 +343,14 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
pci_set_drvdata(pdev, mdev); pci_set_drvdata(pdev, mdev);
dev = container_of(mdev, struct mt792x_dev, mt76);
regs = pcim_iomap_region(pdev, 0, pci_name(pdev)); regs = pcim_iomap_region(pdev, 0, pci_name(pdev));
if (IS_ERR(regs)) { if (IS_ERR(regs)) {
ret = PTR_ERR(regs); ret = PTR_ERR(regs);
goto err_free_dev; goto err_free_dev;
} }
dev = container_of(mdev, struct mt792x_dev, mt76);
dev->fw_features = features; dev->fw_features = features;
dev->hif_ops = &mt7921_pcie_ops; dev->hif_ops = &mt7921_pcie_ops;
dev->irq_map = &irq_map; dev->irq_map = &irq_map;