Skip to content

Commit

Permalink
PCI: rcar: Fix error exit path
Browse files Browse the repository at this point in the history
Commit 90634e8 ("PCI: rcar: Convert PCI scan API to
pci_scan_root_bus_bridge()") converted PCI root bus scan API to the new
pci_scan_root_bus_bridge() API; in the process some error paths were not
updated correctly which may cause memory leaks.

Fix the driver error exit path reinstating the previous correct
error exit behaviour.

Fixes: 90634e8 ("PCI: rcar: Convert PCI scan API to pci_scan_root_bus_bridge()")
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Harunobu Kurokawa <harunobu.kurokawa.dn@renesas.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
  • Loading branch information
Lorenzo Pieralisi authored and Bjorn Helgaas committed Aug 15, 2017
1 parent 16f73eb commit 3c60e01
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions drivers/pci/host/pcie-rcar.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,10 +471,8 @@ static int rcar_pcie_enable(struct rcar_pcie *pcie)
bridge->msi = &pcie->msi.chip;

ret = pci_scan_root_bus_bridge(bridge);
if (ret < 0) {
kfree(bridge);
if (ret < 0)
return ret;
}

bus = bridge->bus;

Expand Down Expand Up @@ -1190,14 +1188,15 @@ static int rcar_pcie_probe(struct platform_device *pdev)

return 0;

err_free_bridge:
pci_free_host_bridge(bridge);

err_pm_put:
pm_runtime_put(dev);

err_pm_disable:
pm_runtime_disable(dev);

err_free_bridge:
pci_free_host_bridge(bridge);

return err;
}

Expand Down

0 comments on commit 3c60e01

Please sign in to comment.