Skip to content

Commit

Permalink
PCI: iproc: Free resource list after registration
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hauke Mehrtens authored and Bjorn Helgaas committed May 27, 2015
1 parent 18c4342 commit ef07991
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions drivers/pci/host/pcie-iproc-bcma.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ static int iproc_pcie_bcma_probe(struct bcma_device *bdev)
pcie->map_irq = iproc_pcie_bcma_map_irq;

ret = iproc_pcie_setup(pcie, &res);
if (ret) {
if (ret)
dev_err(pcie->dev, "PCIe controller setup failed\n");
return ret;
}

return 0;
pci_free_resource_list(&res);

return ret;
}

static void iproc_pcie_bcma_remove(struct bcma_device *bdev)
Expand Down
8 changes: 4 additions & 4 deletions drivers/pci/host/pcie-iproc-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ static int iproc_pcie_pltfm_probe(struct platform_device *pdev)
pcie->map_irq = of_irq_parse_and_map_pci;

ret = iproc_pcie_setup(pcie, &res);
if (ret) {
if (ret)
dev_err(pcie->dev, "PCIe controller setup failed\n");
return ret;
}

return 0;
pci_free_resource_list(&res);

return ret;
}

static int iproc_pcie_pltfm_remove(struct platform_device *pdev)
Expand Down

0 comments on commit ef07991

Please sign in to comment.