Skip to content

Commit ef07991

Browse files
haukebjorn-helgaas
authored andcommitted
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 <[email protected]> Signed-off-by: Hauke Mehrtens <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Ray Jui <[email protected]>
1 parent 18c4342 commit ef07991

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

drivers/pci/host/pcie-iproc-bcma.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ static int iproc_pcie_bcma_probe(struct bcma_device *bdev)
6565
pcie->map_irq = iproc_pcie_bcma_map_irq;
6666

6767
ret = iproc_pcie_setup(pcie, &res);
68-
if (ret) {
68+
if (ret)
6969
dev_err(pcie->dev, "PCIe controller setup failed\n");
70-
return ret;
71-
}
7270

73-
return 0;
71+
pci_free_resource_list(&res);
72+
73+
return ret;
7474
}
7575

7676
static void iproc_pcie_bcma_remove(struct bcma_device *bdev)

drivers/pci/host/pcie-iproc-platform.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,12 @@ static int iproc_pcie_pltfm_probe(struct platform_device *pdev)
7272
pcie->map_irq = of_irq_parse_and_map_pci;
7373

7474
ret = iproc_pcie_setup(pcie, &res);
75-
if (ret) {
75+
if (ret)
7676
dev_err(pcie->dev, "PCIe controller setup failed\n");
77-
return ret;
78-
}
7977

80-
return 0;
78+
pci_free_resource_list(&res);
79+
80+
return ret;
8181
}
8282

8383
static int iproc_pcie_pltfm_remove(struct platform_device *pdev)

0 commit comments

Comments
 (0)