summaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas2016-05-31 18:07:30 +0200
committerBjorn Helgaas2016-06-20 21:06:05 +0200
commit11659a1d54b670f05ff91627934aaadf376db937 (patch)
tree80858dbf97bf6bb0fd99e6066fa4d060d28a243e /drivers/pci
parentPCI: iproc: Request host bridge window resources (diff)
downloadkernel-qcow2-linux-11659a1d54b670f05ff91627934aaadf376db937.tar.gz
kernel-qcow2-linux-11659a1d54b670f05ff91627934aaadf376db937.tar.xz
kernel-qcow2-linux-11659a1d54b670f05ff91627934aaadf376db937.zip
PCI: xgene: Free bridge resource list on failure
of_pci_get_host_bridge_resources() allocates a list of resources for host bridge windows. If we fail after allocating that list, free it before we return error. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/host/pci-xgene.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/pci/host/pci-xgene.c b/drivers/pci/host/pci-xgene.c
index ae00ce22d5a6..bc4e1c61206c 100644
--- a/drivers/pci/host/pci-xgene.c
+++ b/drivers/pci/host/pci-xgene.c
@@ -542,12 +542,14 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)
ret = xgene_pcie_setup(port, &res, iobase);
if (ret)
- return ret;
+ goto error;
bus = pci_create_root_bus(&pdev->dev, 0,
&xgene_pcie_ops, port, &res);
- if (!bus)
- return -ENOMEM;
+ if (!bus) {
+ ret = -ENOMEM;
+ goto error;
+ }
pci_scan_child_bus(bus);
pci_assign_unassigned_bus_resources(bus);
@@ -555,6 +557,10 @@ static int xgene_pcie_probe_bridge(struct platform_device *pdev)
platform_set_drvdata(pdev, port);
return 0;
+
+error:
+ pci_free_resource_list(&res);
+ return ret;
}
static const struct of_device_id xgene_pcie_match_table[] = {