diff options
author | Lorenzo Bianconi <lorenzo@kernel.org> | 2020-04-30 23:31:03 +0300 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2020-05-12 20:52:34 +0300 |
commit | a69b0b30e661eadfe1931c4c5751c2de7905f016 (patch) | |
tree | 8ebc6fce8118a7da467ef4d8b2447905d9129337 /drivers/net/wireless/mediatek/mt76/mt7615/pci.c | |
parent | 4432119d17828ce7a66d74f898c52ca4a147ba92 (diff) | |
download | linux-a69b0b30e661eadfe1931c4c5751c2de7905f016.tar.xz |
mt76: mt7615: free pci_vector if mt7615_pci_probe fails
Always free pci irq vector if mt7615_pci_probe routine fails
Moreover free irq in mt7615_pci_remove routine
Co-developed-by: Soul Huang <sean.wang@mediatek.com>
Signed-off-by: Soul Huang <sean.wang@mediatek.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'drivers/net/wireless/mediatek/mt76/mt7615/pci.c')
-rw-r--r-- | drivers/net/wireless/mediatek/mt76/mt7615/pci.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/pci.c b/drivers/net/wireless/mediatek/mt76/mt7615/pci.c index f9469198cabd..0605c908059e 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/pci.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/pci.c @@ -39,13 +39,21 @@ static int mt7615_pci_probe(struct pci_dev *pdev, ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (ret) - return ret; + goto error; mt76_pci_disable_aspm(pdev); map = id->device == 0x7663 ? mt7663e_reg_map : mt7615e_reg_map; - return mt7615_mmio_probe(&pdev->dev, pcim_iomap_table(pdev)[0], - pdev->irq, map); + ret = mt7615_mmio_probe(&pdev->dev, pcim_iomap_table(pdev)[0], + pdev->irq, map); + if (ret) + goto error; + + return 0; +error: + pci_free_irq_vectors(pdev); + + return ret; } static void mt7615_pci_remove(struct pci_dev *pdev) @@ -54,6 +62,7 @@ static void mt7615_pci_remove(struct pci_dev *pdev) struct mt7615_dev *dev = container_of(mdev, struct mt7615_dev, mt76); mt7615_unregister_device(dev); + devm_free_irq(&pdev->dev, pdev->irq, dev); pci_free_irq_vectors(pdev); } |