Skip to content

Commit

Permalink
PCI: tegra: Fix host bridge memory leakage
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lorenzo Pieralisi authored and Bjorn Helgaas committed Jun 28, 2017
1 parent 9aa17a7 commit 792abc6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/pci/host/pci-tegra.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 792abc6

Please sign in to comment.