mt76: mt7921: Fix the error handling path of mt7921_pci_probe()
[ Upstream commit4e90db5e21
] 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:602cc0c961
("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: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
047409efc1
commit
83ebfe4f04
|
@ -300,8 +300,10 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
|
||||||
dev->bus_ops = dev->mt76.bus;
|
dev->bus_ops = dev->mt76.bus;
|
||||||
bus_ops = devm_kmemdup(dev->mt76.dev, dev->bus_ops, sizeof(*bus_ops),
|
bus_ops = devm_kmemdup(dev->mt76.dev, dev->bus_ops, sizeof(*bus_ops),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!bus_ops)
|
if (!bus_ops) {
|
||||||
return -ENOMEM;
|
ret = -ENOMEM;
|
||||||
|
goto err_free_dev;
|
||||||
|
}
|
||||||
|
|
||||||
bus_ops->rr = mt7921_rr;
|
bus_ops->rr = mt7921_rr;
|
||||||
bus_ops->wr = mt7921_wr;
|
bus_ops->wr = mt7921_wr;
|
||||||
|
@ -310,7 +312,7 @@ static int mt7921_pci_probe(struct pci_dev *pdev,
|
||||||
|
|
||||||
ret = __mt7921e_mcu_drv_pmctrl(dev);
|
ret = __mt7921e_mcu_drv_pmctrl(dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
goto err_free_dev;
|
||||||
|
|
||||||
mdev->rev = (mt7921_l1_rr(dev, MT_HW_CHIPID) << 16) |
|
mdev->rev = (mt7921_l1_rr(dev, MT_HW_CHIPID) << 16) |
|
||||||
(mt7921_l1_rr(dev, MT_HW_REV) & 0xff);
|
(mt7921_l1_rr(dev, MT_HW_REV) & 0xff);
|
||||||
|
|
Loading…
Reference in New Issue