aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJose Abreu <jose.abreu@synopsys.com>2019-01-09 04:05:56 -0500
committerDavid S. Miller <davem@davemloft.net>2019-01-11 18:35:06 -0500
commit6dea7e1881fd86b80da64e476ac398008daed857 (patch)
tree73ca61cfe62d08b6033eee71dfe6757ef080d698
parente8b108b050e84b6d7497d2cd29fe7623d0a33ed6 (diff)
net: stmmac: Fix PCI module removal leak
Since commit b7d0f08e9129, the enable / disable of PCI device is not managed which will result in IO regions not being automatically unmapped. As regions continue mapped it is currently not possible to remove and then probe again the PCI module of stmmac. Fix this by manually unmapping regions on remove callback. Changes from v1: - Fix build error Cc: Joao Pinto <jpinto@synopsys.com> Cc: David S. Miller <davem@davemloft.net> Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com> Cc: Alexandre Torgue <alexandre.torgue@st.com> Fixes: b7d0f08e9129 ("net: stmmac: Fix WoL for PCI-based setups") Signed-off-by: Jose Abreu <joabreu@synopsys.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index c54a50dbd5ac..d819e8eaba12 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -299,7 +299,17 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
299 */ 299 */
300static void stmmac_pci_remove(struct pci_dev *pdev) 300static void stmmac_pci_remove(struct pci_dev *pdev)
301{ 301{
302 int i;
303
302 stmmac_dvr_remove(&pdev->dev); 304 stmmac_dvr_remove(&pdev->dev);
305
306 for (i = 0; i <= PCI_STD_RESOURCE_END; i++) {
307 if (pci_resource_len(pdev, i) == 0)
308 continue;
309 pcim_iounmap_regions(pdev, BIT(i));
310 break;
311 }
312
303 pci_disable_device(pdev); 313 pci_disable_device(pdev);
304} 314}
305 315