]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
of/pci: Fix pci_get_host_bridge_device leak
authorSuthikulpanit, Suravee <Suravee.Suthikulpanit@amd.com>
Wed, 28 Oct 2015 22:50:52 +0000 (15:50 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Sat, 7 Nov 2015 00:29:22 +0000 (01:29 +0100)
In case of error, the current code return w/o calling
pci_put_host_bridge_device. This patch fixes this.

Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/of/of_pci.c

index 5751dc5b6494d41fd0ed9fd88cc877f3d10707a0..a2f510cc683b023d20c48549315296cc96062036 100644 (file)
@@ -129,10 +129,9 @@ void of_pci_dma_configure(struct pci_dev *pci_dev)
        struct device *dev = &pci_dev->dev;
        struct device *bridge = pci_get_host_bridge_device(pci_dev);
 
-       if (!bridge->parent)
-               return;
+       if (bridge->parent)
+               of_dma_configure(dev, bridge->parent->of_node);
 
-       of_dma_configure(dev, bridge->parent->of_node);
        pci_put_host_bridge_device(bridge);
 }
 EXPORT_SYMBOL_GPL(of_pci_dma_configure);