Commit 3c60e01a authored by Lorenzo Pieralisi's avatar Lorenzo Pieralisi Committed by Bjorn Helgaas

PCI: rcar: Fix error exit path

Commit 90634e85 ("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: 90634e85 ("PCI: rcar: Convert PCI scan API to pci_scan_root_bus_bridge()")
Signed-off-by: default avatarLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: default avatarHarunobu Kurokawa <harunobu.kurokawa.dn@renesas.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Acked-by: default avatarSimon Horman <horms+renesas@verge.net.au>
parent 16f73eb0
...@@ -471,10 +471,8 @@ static int rcar_pcie_enable(struct rcar_pcie *pcie) ...@@ -471,10 +471,8 @@ static int rcar_pcie_enable(struct rcar_pcie *pcie)
bridge->msi = &pcie->msi.chip; bridge->msi = &pcie->msi.chip;
ret = pci_scan_root_bus_bridge(bridge); ret = pci_scan_root_bus_bridge(bridge);
if (ret < 0) { if (ret < 0)
kfree(bridge);
return ret; return ret;
}
bus = bridge->bus; bus = bridge->bus;
...@@ -1190,14 +1188,15 @@ static int rcar_pcie_probe(struct platform_device *pdev) ...@@ -1190,14 +1188,15 @@ static int rcar_pcie_probe(struct platform_device *pdev)
return 0; return 0;
err_free_bridge:
pci_free_host_bridge(bridge);
err_pm_put: err_pm_put:
pm_runtime_put(dev); pm_runtime_put(dev);
err_pm_disable: err_pm_disable:
pm_runtime_disable(dev); pm_runtime_disable(dev);
err_free_bridge:
pci_free_host_bridge(bridge);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment