diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2016-05-31 12:26:01 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2016-06-20 15:06:06 -0400 |
commit | 0bb01307557ca5042fb96bc5261b847a68203ba2 (patch) | |
tree | f558613c2cc65cd7a76975ef973c61fae690204a | |
parent | 93a5b5e5876e45096d0e448bbdc4cf715f2f346e (diff) |
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>
-rw-r--r-- | drivers/pci/host/pcie-xilinx-nwl.c | 14 |
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) | |||
832 | err = nwl_pcie_init_irq_domain(pcie); | 832 | err = nwl_pcie_init_irq_domain(pcie); |
833 | if (err) { | 833 | if (err) { |
834 | dev_err(pcie->dev, "Failed creating IRQ Domain\n"); | 834 | dev_err(pcie->dev, "Failed creating IRQ Domain\n"); |
835 | return err; | 835 | goto error; |
836 | } | 836 | } |
837 | 837 | ||
838 | bus = pci_create_root_bus(&pdev->dev, pcie->root_busno, | 838 | bus = pci_create_root_bus(&pdev->dev, pcie->root_busno, |
839 | &nwl_pcie_ops, pcie, &res); | 839 | &nwl_pcie_ops, pcie, &res); |
840 | if (!bus) | 840 | if (!bus) { |
841 | return -ENOMEM; | 841 | err = -ENOMEM; |
842 | goto error; | ||
843 | } | ||
842 | 844 | ||
843 | if (IS_ENABLED(CONFIG_PCI_MSI)) { | 845 | if (IS_ENABLED(CONFIG_PCI_MSI)) { |
844 | err = nwl_pcie_enable_msi(pcie, bus); | 846 | err = nwl_pcie_enable_msi(pcie, bus); |
845 | if (err < 0) { | 847 | if (err < 0) { |
846 | dev_err(&pdev->dev, | 848 | dev_err(&pdev->dev, |
847 | "failed to enable MSI support: %d\n", err); | 849 | "failed to enable MSI support: %d\n", err); |
848 | return err; | 850 | goto error; |
849 | } | 851 | } |
850 | } | 852 | } |
851 | pci_scan_child_bus(bus); | 853 | pci_scan_child_bus(bus); |
@@ -855,6 +857,10 @@ static int nwl_pcie_probe(struct platform_device *pdev) | |||
855 | pci_bus_add_devices(bus); | 857 | pci_bus_add_devices(bus); |
856 | platform_set_drvdata(pdev, pcie); | 858 | platform_set_drvdata(pdev, pcie); |
857 | return 0; | 859 | return 0; |
860 | |||
861 | error: | ||
862 | pci_free_resource_list(&res); | ||
863 | return err; | ||
858 | } | 864 | } |
859 | 865 | ||
860 | static int nwl_pcie_remove(struct platform_device *pdev) | 866 | static int nwl_pcie_remove(struct platform_device *pdev) |