This patch adds single WARN_ONCE() check for catching 'enable_cnt' imbalances.

Signed-off-by: Konstantin Khlebnikov <[email protected]>
Cc: [email protected]
Cc: Bjorn Helgaas <[email protected]>
---
 drivers/pci/pci.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 5cb5820..ff93f8f 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,
+                       "enable counter underflow");
+
        if (atomic_sub_return(1, &dev->enable_cnt) != 0)
                return;
 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to