From 97fc0e785d0e60dcd79b485669c7c049ef9971d4 Mon Sep 17 00:00:00 2001 From: Hongling Zeng Date: Wed, 13 May 2026 10:14:55 +0800 Subject: [PATCH] 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 Closes: https://lore.kernel.org/oe-kbuild-all/202605130432.S8Ozipm2-lkp@intel.com/ Signed-off-by: Hongling Zeng Link: https://patch.msgid.link/20260513021455.80175-1-zenghongling@kylinos.cn Signed-off-by: Felix Fietkau --- mt7921/pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mt7921/pci.c b/mt7921/pci.c index 1edfd20d..3b404e15 100644 --- a/mt7921/pci.c +++ b/mt7921/pci.c @@ -343,13 +343,14 @@ static int mt7921_pci_probe(struct pci_dev *pdev, pci_set_drvdata(pdev, mdev); + dev = container_of(mdev, struct mt792x_dev, mt76); + regs = pcim_iomap_region(pdev, 0, pci_name(pdev)); if (IS_ERR(regs)) { ret = PTR_ERR(regs); goto err_free_dev; } - dev = container_of(mdev, struct mt792x_dev, mt76); dev->fw_features = features; dev->hif_ops = &mt7921_pcie_ops; dev->irq_map = &irq_map;