Skip to content

Commit

Permalink
mt76: mt7921: Fix the error handling path of mt7921_pci_probe()
Browse files Browse the repository at this point in the history
commit 4e90db5 upstream.

In case of error, some resources must be freed, as already done above and
below the devm_kmemdup() and __mt7921e_mcu_drv_pmctrl() calls added in the
commit in Fixes:.

Fixes: 602cc0c ("mt76: mt7921e: fix possible probe failure after reboot")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
tititiou36 authored and gregkh committed Jul 29, 2022
1 parent 22b910a commit cf719ad
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/wireless/mediatek/mt76/mt7921/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,10 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
dev->bus_ops = dev->mt76.bus;
bus_ops = devm_kmemdup(dev->mt76.dev, dev->bus_ops, sizeof(*bus_ops),
GFP_KERNEL);
if (!bus_ops)
return -ENOMEM;
if (!bus_ops) {
ret = -ENOMEM;
goto err_free_dev;
}

bus_ops->rr = mt7921_rr;
bus_ops->wr = mt7921_wr;
Expand All @@ -264,7 +266,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev,

ret = __mt7921e_mcu_drv_pmctrl(dev);
if (ret)
return ret;
goto err_free_dev;

mdev->rev = (mt7921_l1_rr(dev, MT_HW_CHIPID) << 16) |
(mt7921_l1_rr(dev, MT_HW_REV) & 0xff);
Expand Down

0 comments on commit cf719ad

Please sign in to comment.