mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
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: a86f1d01f5ce5 ("mt76: move mt76 workqueue in common code")
Fixes: f1d962369d568 ("mt76: mt7915: implement HE per-rate tx power support")
Signed-off-by: Lorenzo Bianconi <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
36089a655f
commit
68c4eedafd
+2
-1
@@ -57,7 +57,8 @@ mt76pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
error:
|
error:
|
||||||
ieee80211_free_hw(mt76_hw(dev));
|
mt76_free_device(&dev->mt76);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -240,7 +240,8 @@ int mt7615_mmio_probe(struct device *pdev, void __iomem *mem_base,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
error:
|
error:
|
||||||
ieee80211_free_hw(mt76_hw(dev));
|
mt76_free_device(&dev->mt76);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -194,7 +194,8 @@ mt76x0e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
ieee80211_free_hw(mt76_hw(dev));
|
mt76_free_device(&dev->mt76);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -90,7 +90,8 @@ mt76x2e_probe(struct pci_dev *pdev, const struct pci_device_id *id)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
ieee80211_free_hw(mt76_hw(dev));
|
mt76_free_device(&dev->mt76);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -108,7 +108,7 @@ static int mt7915_pci_probe(struct pci_dev *pdev,
|
|||||||
|
|
||||||
ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
|
ret = pci_set_dma_mask(pdev, DMA_BIT_MASK(32));
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
goto error;
|
||||||
|
|
||||||
mdev = mt76_alloc_device(&pdev->dev, sizeof(*dev), &mt7915_ops,
|
mdev = mt76_alloc_device(&pdev->dev, sizeof(*dev), &mt7915_ops,
|
||||||
&drv_ops);
|
&drv_ops);
|
||||||
@@ -138,7 +138,8 @@ static int mt7915_pci_probe(struct pci_dev *pdev,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
error:
|
error:
|
||||||
ieee80211_free_hw(mt76_hw(dev));
|
mt76_free_device(&dev->mt76);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user