diff options
author | Keith Busch <keith.busch@intel.com> | 2017-03-29 22:49:17 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2017-03-29 22:55:16 -0500 |
commit | fe2bd75b2290bf6acd4b91312697e445668dd773 (patch) | |
tree | 2292b23906bd7d205c3f79a877d1b839a6bc4bf5 /drivers/pci/pci.c | |
parent | 0170591bb06788034ae72bfa56e42f283ab3de5a (diff) |
PCI: Short-circuit pci_device_is_present() for disconnected devices
If the PCI device is disconnected, return false immediately from
pci_device_is_present(). pci_device_is_present() uses the bus accessors,
so the early return in the device accessors doesn't help here.
Tested-by: Krishna Dhulipala <krishnad@fb.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Wei Zhang <wzhang@fb.com>
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 7904d02ffdb9..8ab0a0d3cddb 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -4932,6 +4932,8 @@ bool pci_device_is_present(struct pci_dev *pdev) { u32 v; + if (pci_dev_is_disconnected(pdev)) + return false; return pci_bus_read_dev_vendor_id(pdev->bus, pdev->devfn, &v, 0); } EXPORT_SYMBOL_GPL(pci_device_is_present); |