PCI: tegra: Fix host bridge memory leakage
authorLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Wed, 28 Jun 2017 20:13:54 +0000 (15:13 -0500)
committerBjorn Helgaas <bhelgaas@google.com>
Wed, 28 Jun 2017 20:13:54 +0000 (15:13 -0500)
When probing the PCI host controller driver, if an error occurs, the probe
function code does not free memory allocated for the struct pci_host_bridge
resulting in memory leakage.

Move the struct pci_host_bridge allocation over to the respective devm
interface to fix the issue.

Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Cc: Arnd Bergmann <arnd@arndb.de>
drivers/pci/host/pci-tegra.c

index 2618f875a600d63aea25aebbee2a145587d540f9..84c98a2bffeb0c1c64e652fd0fb9959d24997dd3 100644 (file)
@@ -2238,7 +2238,7 @@ static int tegra_pcie_probe(struct platform_device *pdev)
        struct pci_bus *child;
        int err;
 
-       host = pci_alloc_host_bridge(sizeof(*pcie));
+       host = devm_pci_alloc_host_bridge(dev, sizeof(*pcie));
        if (!host)
                return -ENOMEM;