bcm53xx: add early support for Linksys EA6300 V1
[openwrt/openwrt.git] / target / linux / bcm53xx / patches-4.1 / 033-PCI-iproc-Free-resource-list-after-registration.patch
1 From ef07991a95de76b07594448c3521361831ec2cfe Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sun, 24 May 2015 22:37:03 +0200
4 Subject: [PATCH 2/2] PCI: iproc: Free resource list after registration
5
6 The resource list is only used in the setup process and was never freed.
7 pci_add_resource() allocates a memory area to store the list item.
8
9 Fix the memory leak.
10
11 Tested-by: Ray Jui <rjui@broadcom.com>
12 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
13 Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
14 Reviewed-by: Ray Jui <rjui@broadcom.com>
15 ---
16 drivers/pci/host/pcie-iproc-bcma.c | 8 ++++----
17 drivers/pci/host/pcie-iproc-platform.c | 8 ++++----
18 2 files changed, 8 insertions(+), 8 deletions(-)
19
20 --- a/drivers/pci/host/pcie-iproc-bcma.c
21 +++ b/drivers/pci/host/pcie-iproc-bcma.c
22 @@ -65,12 +65,12 @@ static int iproc_pcie_bcma_probe(struct
23 pcie->map_irq = iproc_pcie_bcma_map_irq;
24
25 ret = iproc_pcie_setup(pcie, &res);
26 - if (ret) {
27 + if (ret)
28 dev_err(pcie->dev, "PCIe controller setup failed\n");
29 - return ret;
30 - }
31
32 - return 0;
33 + pci_free_resource_list(&res);
34 +
35 + return ret;
36 }
37
38 static void iproc_pcie_bcma_remove(struct bcma_device *bdev)
39 --- a/drivers/pci/host/pcie-iproc-platform.c
40 +++ b/drivers/pci/host/pcie-iproc-platform.c
41 @@ -72,12 +72,12 @@ static int iproc_pcie_pltfm_probe(struct
42 pcie->map_irq = of_irq_parse_and_map_pci;
43
44 ret = iproc_pcie_setup(pcie, &res);
45 - if (ret) {
46 + if (ret)
47 dev_err(pcie->dev, "PCIe controller setup failed\n");
48 - return ret;
49 - }
50
51 - return 0;
52 + pci_free_resource_list(&res);
53 +
54 + return ret;
55 }
56
57 static int iproc_pcie_pltfm_remove(struct platform_device *pdev)