aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/search.c
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@huawei.com>2013-01-21 13:20:45 -0800
committerBjorn Helgaas <bhelgaas@google.com>2013-01-25 13:49:27 -0700
commitd5af7d987a494a1b85e176b4c33dc115cb111662 (patch)
treeb4566d25bb2b102d4d4ae9138f6f4c26caea848d /drivers/pci/search.c
parentPCI: Set pci_dev dev_node early so IOAPIC irq_descs are allocated locally (diff)
downloadlinux-dev-d5af7d987a494a1b85e176b4c33dc115cb111662.tar.xz
linux-dev-d5af7d987a494a1b85e176b4c33dc115cb111662.zip
PCI: Fix reference count leak in pci_dev_present()
Function pci_get_dev_by_id() takes a reference on the pci_dev returned, so pci_dev_present() should release the corresponding reference. Signed-off-by: Jiang Liu <jiang.liu@huawei.com> Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/pci/search.c')
-rw-r--r--drivers/pci/search.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/pci/search.c b/drivers/pci/search.c
index bf969ba58e59..d0627fa9f368 100644
--- a/drivers/pci/search.c
+++ b/drivers/pci/search.c
@@ -319,13 +319,13 @@ int pci_dev_present(const struct pci_device_id *ids)
WARN_ON(in_interrupt());
while (ids->vendor || ids->subvendor || ids->class_mask) {
found = pci_get_dev_by_id(ids, NULL);
- if (found)
- goto exit;
+ if (found) {
+ pci_dev_put(found);
+ return 1;
+ }
ids++;
}
-exit:
- if (found)
- return 1;
+
return 0;
}
EXPORT_SYMBOL(pci_dev_present);