summaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorKonstantin Khlebnikov <khlebnikov@openvz.org>2013-02-04 15:56:01 +0400
committerBjorn Helgaas <bhelgaas@google.com>2013-02-11 17:25:04 -0700
commitfd6dceab017e6be6c158dc56ec6dacf817f21a5b (patch)
tree0c46af88031a7e334044a892dcf24fca6efe2e44 /drivers/pci
parent7897e6022761ace7377f0f784fca059da55f5d71 (diff)
downloadop-kernel-dev-fd6dceab017e6be6c158dc56ec6dacf817f21a5b.zip
op-kernel-dev-fd6dceab017e6be6c158dc56ec6dacf817f21a5b.tar.gz
PCI: Catch attempts to disable already-disabled devices
Warn when disabling a device that has already been disabled. [bhelgaas: message wording] Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 5cb5820..29a09b7 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1401,6 +1401,9 @@ pci_disable_device(struct pci_dev *dev)
if (dr)
dr->enabled = 0;
+ dev_WARN_ONCE(&dev->dev, atomic_read(&dev->enable_cnt) <= 0,
+ "disabling already-disabled device");
+
if (atomic_sub_return(1, &dev->enable_cnt) != 0)
return;
OpenPOWER on IntegriCloud