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>
This commit is contained in:
Konstantin Khlebnikov 2013-02-04 15:56:01 +04:00 committed by Bjorn Helgaas
parent 7897e60227
commit fd6dceab01
1 changed files with 3 additions and 0 deletions

View File

@ -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;