Commit bc348def authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: fix memory leak if device probing fails

Run mt76_free_device instead of ieee80211_free_hw if device probing
fails in order to remove the already allocated mt76 workqueue

Fixes: a86f1d01 ("mt76: move mt76 workqueue in common code")
Fixes: f1d96236 ("mt76: mt7915: implement HE per-rate tx power support")
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 468cc93b
......@@ -57,7 +57,8 @@ mt76pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
return 0;
error:
ieee80211_free_hw(mt76_hw(dev));
mt76_free_device(&dev->mt76);
return ret;
}
......
......@@ -240,7 +240,8 @@ int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base,
return 0;
error:
ieee80211_free_hw(mt76_hw(dev));
mt76_free_device(&dev->mt76);
return ret;
}
......
......@@ -194,7 +194,8 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
return 0;
error:
ieee80211_free_hw(mt76_hw(dev));
mt76_free_device(&dev->mt76);
return ret;
}
......
......@@ -90,7 +90,8 @@ mt76x2e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
return 0;
error:
ieee80211_free_hw(mt76_hw(dev));
mt76_free_device(&dev->mt76);
return ret;
}
......
......@@ -140,7 +140,7 @@ static int mt7915_pci_probe(struct pci_dev *pdev,
dev = container_of(mdev, struct mt7915_dev, mt76);
ret = mt7915_alloc_device(pdev, dev);
if (ret)
return ret;
goto error;
mt76_mmio_init(&dev->mt76, pcim_iomap_table(pdev)[0]);
mdev->rev = (mt7915_l1_rr(dev, MT_HW_CHIPID) << 16) |
......@@ -163,7 +163,8 @@ static int mt7915_pci_probe(struct pci_dev *pdev,
return 0;
error:
ieee80211_free_hw(mt76_hw(dev));
mt76_free_device(&dev->mt76);
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment