linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: rcar-pcie: Fix memory leak when no PCIe card is inserted
@ 2017-08-02  7:13 Harunobu Kurokawa
  2017-08-02  9:03 ` Lorenzo Pieralisi
  0 siblings, 1 reply; 3+ messages in thread
From: Harunobu Kurokawa @ 2017-08-02  7:13 UTC (permalink / raw)
  To: horms, bhelgaas, linux-pci
  Cc: linux-renesas-soc, linux-kernel, Harunobu Kurokawa

When no PCIe card is inserted, there is a memory leak as
pci_free_resource_list is not called before returning.

Signed-off-by: Harunobu Kurokawa <harunobu.kurokawa.dn@renesas.com>
---
 drivers/pci/host/pcie-rcar.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pcie-rcar.c b/drivers/pci/host/pcie-rcar.c
index ac80fbb..9b06de6 100644
--- a/drivers/pci/host/pcie-rcar.c
+++ b/drivers/pci/host/pcie-rcar.c
@@ -1190,14 +1190,15 @@ static int rcar_pcie_probe(struct platform_device *pdev)
 
 	return 0;
 
-err_free_bridge:
-	pci_free_host_bridge(bridge);
-
 err_pm_put:
 	pm_runtime_put(dev);
 
 err_pm_disable:
 	pm_runtime_disable(dev);
+
+err_free_bridge:
+	pci_free_host_bridge(bridge);
+	pci_free_resource_list(&pcie->resources);
 	return err;
 }
 
-- 
2.9.2

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-08-03  5:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-02  7:13 [PATCH] PCI: rcar-pcie: Fix memory leak when no PCIe card is inserted Harunobu Kurokawa
2017-08-02  9:03 ` Lorenzo Pieralisi
2017-08-03  5:07   ` HARUNOBU KUROKAWA

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).