Skip to content

Commit

Permalink
PCI: Catch attempts to disable already-disabled devices
Browse files Browse the repository at this point in the history
Warn when disabling a device that has already been disabled.

[bhelgaas: message wording]
Signed-off-by: Konstantin Khlebnikov <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
Acked-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
koct9i authored and bjorn-helgaas committed Feb 12, 2013
1 parent 7897e60 commit fd6dcea
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit fd6dcea

Please sign in to comment.