summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSuthikulpanit, Suravee <Suravee.Suthikulpanit@amd.com>2015-10-28 15:50:52 -0700
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-11-07 01:29:22 +0100
commit37efbe20fb19cee43d95b7ba9e54d5d0b00c0d67 (patch)
tree48f7873f8d9e6e1d9ecb19b58ef825872a525c80
parentab3d527329f01dd63dc852041006d1a24895d116 (diff)
of/pci: Fix pci_get_host_bridge_device leak
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>
-rw-r--r--drivers/of/of_pci.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/of/of_pci.c b/drivers/of/of_pci.c
index 5751dc5b6494..a2f510cc683b 100644
--- a/drivers/of/of_pci.c
+++ b/drivers/of/of_pci.c
@@ -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);