Commit c41be7a6 authored by Bjorn Helgaas's avatar Bjorn Helgaas

PCI: xilinx: 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: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 0ccb7eef
...@@ -660,7 +660,6 @@ static int xilinx_pcie_probe(struct platform_device *pdev) ...@@ -660,7 +660,6 @@ static int xilinx_pcie_probe(struct platform_device *pdev)
struct xilinx_pcie_port *port; struct xilinx_pcie_port *port;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct pci_bus *bus; struct pci_bus *bus;
int err; int err;
resource_size_t iobase = 0; resource_size_t iobase = 0;
LIST_HEAD(res); LIST_HEAD(res);
...@@ -696,8 +695,10 @@ static int xilinx_pcie_probe(struct platform_device *pdev) ...@@ -696,8 +695,10 @@ static int xilinx_pcie_probe(struct platform_device *pdev)
} }
bus = pci_create_root_bus(&pdev->dev, 0, bus = pci_create_root_bus(&pdev->dev, 0,
&xilinx_pcie_ops, port, &res); &xilinx_pcie_ops, port, &res);
if (!bus) if (!bus) {
return -ENOMEM; err = -ENOMEM;
goto error;
}
#ifdef CONFIG_PCI_MSI #ifdef CONFIG_PCI_MSI
xilinx_pcie_msi_chip.dev = port->dev; xilinx_pcie_msi_chip.dev = port->dev;
...@@ -712,6 +713,10 @@ static int xilinx_pcie_probe(struct platform_device *pdev) ...@@ -712,6 +713,10 @@ static int xilinx_pcie_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, port); platform_set_drvdata(pdev, port);
return 0; return 0;
error:
pci_free_resource_list(&res);
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