diff options
| author | Hauke Mehrtens <hauke@hauke-m.de> | 2015-05-24 16:37:03 -0400 |
|---|---|---|
| committer | Bjorn Helgaas <bhelgaas@google.com> | 2015-05-27 19:34:05 -0400 |
| commit | ef07991a95de76b07594448c3521361831ec2cfe (patch) | |
| tree | 028f4d52668d97e3ca04322e004c7a71b154c33f | |
| parent | 18c4342aa56d70176eea85021e6fe8f6f8f39c7b (diff) | |
PCI: iproc: Free resource list after registration
The resource list is only used in the setup process and was never freed.
pci_add_resource() allocates a memory area to store the list item.
Fix the memory leak.
Tested-by: Ray Jui <rjui@broadcom.com>
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Ray Jui <rjui@broadcom.com>
| -rw-r--r-- | drivers/pci/host/pcie-iproc-bcma.c | 8 | ||||
| -rw-r--r-- | drivers/pci/host/pcie-iproc-platform.c | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/drivers/pci/host/pcie-iproc-bcma.c b/drivers/pci/host/pcie-iproc-bcma.c index 7a412a145b51..96a7d999fd5e 100644 --- a/drivers/pci/host/pcie-iproc-bcma.c +++ b/drivers/pci/host/pcie-iproc-bcma.c | |||
| @@ -65,12 +65,12 @@ static int iproc_pcie_bcma_probe(struct bcma_device *bdev) | |||
| 65 | pcie->map_irq = iproc_pcie_bcma_map_irq; | 65 | pcie->map_irq = iproc_pcie_bcma_map_irq; |
| 66 | 66 | ||
| 67 | ret = iproc_pcie_setup(pcie, &res); | 67 | ret = iproc_pcie_setup(pcie, &res); |
| 68 | if (ret) { | 68 | if (ret) |
| 69 | dev_err(pcie->dev, "PCIe controller setup failed\n"); | 69 | dev_err(pcie->dev, "PCIe controller setup failed\n"); |
| 70 | return ret; | ||
| 71 | } | ||
| 72 | 70 | ||
| 73 | return 0; | 71 | pci_free_resource_list(&res); |
| 72 | |||
| 73 | return ret; | ||
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | static void iproc_pcie_bcma_remove(struct bcma_device *bdev) | 76 | static void iproc_pcie_bcma_remove(struct bcma_device *bdev) |
diff --git a/drivers/pci/host/pcie-iproc-platform.c b/drivers/pci/host/pcie-iproc-platform.c index c5fe4c160972..9aedc8eb2c6e 100644 --- a/drivers/pci/host/pcie-iproc-platform.c +++ b/drivers/pci/host/pcie-iproc-platform.c | |||
| @@ -72,12 +72,12 @@ static int iproc_pcie_pltfm_probe(struct platform_device *pdev) | |||
| 72 | pcie->map_irq = of_irq_parse_and_map_pci; | 72 | pcie->map_irq = of_irq_parse_and_map_pci; |
| 73 | 73 | ||
| 74 | ret = iproc_pcie_setup(pcie, &res); | 74 | ret = iproc_pcie_setup(pcie, &res); |
| 75 | if (ret) { | 75 | if (ret) |
| 76 | dev_err(pcie->dev, "PCIe controller setup failed\n"); | 76 | dev_err(pcie->dev, "PCIe controller setup failed\n"); |
| 77 | return ret; | ||
| 78 | } | ||
| 79 | 77 | ||
| 80 | return 0; | 78 | pci_free_resource_list(&res); |
| 79 | |||
| 80 | return ret; | ||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | static int iproc_pcie_pltfm_remove(struct platform_device *pdev) | 83 | static int iproc_pcie_pltfm_remove(struct platform_device *pdev) |
