summaryrefslogtreecommitdiffstats
path: root/drivers/pci/host/pcie-xilinx-nwl.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2016-05-31 11:26:01 -0500
committerBjorn Helgaas <bhelgaas@google.com>2016-06-20 14:06:06 -0500
commit0bb01307557ca5042fb96bc5261b847a68203ba2 (patch)
treef558613c2cc65cd7a76975ef973c61fae690204a /drivers/pci/host/pcie-xilinx-nwl.c
parent93a5b5e5876e45096d0e448bbdc4cf715f2f346e (diff)
downloadlinux-0bb01307557ca5042fb96bc5261b847a68203ba2.tar.bz2
PCI: xilinx-nwl: 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/host/pcie-xilinx-nwl.c')
-rw-r--r--drivers/pci/host/pcie-xilinx-nwl.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/pci/host/pcie-xilinx-nwl.c b/drivers/pci/host/pcie-xilinx-nwl.c
index 3479d30e2be8..506da7bacf1d 100644
--- a/drivers/pci/host/pcie-xilinx-nwl.c
+++ b/drivers/pci/host/pcie-xilinx-nwl.c
@@ -832,20 +832,22 @@ static int nwl_pcie_probe(struct platform_device *pdev)
err = nwl_pcie_init_irq_domain(pcie);
if (err) {
dev_err(pcie->dev, "Failed creating IRQ Domain\n");
- return err;
+ goto error;
}
bus = pci_create_root_bus(&pdev->dev, pcie->root_busno,
&nwl_pcie_ops, pcie, &res);
- if (!bus)
- return -ENOMEM;
+ if (!bus) {
+ err = -ENOMEM;
+ goto error;
+ }
if (IS_ENABLED(CONFIG_PCI_MSI)) {
err = nwl_pcie_enable_msi(pcie, bus);
if (err < 0) {
dev_err(&pdev->dev,
"failed to enable MSI support: %d\n", err);
- return err;
+ goto error;
}
}
pci_scan_child_bus(bus);
@@ -855,6 +857,10 @@ static int nwl_pcie_probe(struct platform_device *pdev)
pci_bus_add_devices(bus);
platform_set_drvdata(pdev, pcie);
return 0;
+
+error:
+ pci_free_resource_list(&res);
+ return err;
}
static int nwl_pcie_remove(struct platform_device *pdev)