Skip to contentSkip to conversation

MSI: Simplify BUG() handling in pci_disable_msi()

PATCH Eric W. Biederman 1 participant 1 message Mar 28, 2007 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Eric W. Biederman

author Acked-by
#1 lore raw
Quoted 3 lines · Michael Ellerman

Although it might be nice to do a printk before BUG'ing, it's really not necessary, and it complicates the code.

Quoted 37 lines

---

 drivers/pci/msi.c |   19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

Index: msi-new/drivers/pci/msi.c
===================================================================

drivers/pci/msi.c +8 -11
@@ -646,18 +646,15 @@ void pci_disable_msi(struct pci_dev* dev
 	if (!entry || !entry->dev || entry->msi_attrib.type != PCI_CAP_ID_MSI) {
 		return;
 	}
-	if (irq_has_action(dev->first_msi_irq)) {
- printk(KERN_WARNING "PCI: %s: pci_disable_msi() called without "
-		       "free_irq() on MSI irq %d\n",
-		       pci_name(dev), dev->first_msi_irq);
-		BUG_ON(irq_has_action(dev->first_msi_irq));
-	} else {
-		default_irq = entry->msi_attrib.default_irq;
-		msi_free_irq(dev, dev->first_msi_irq);
 
-		/* Restore dev->irq to its default pin-assertion irq */
-		dev->irq = default_irq;
-	}
+	BUG_ON(irq_has_action(dev->first_msi_irq));
+
+	default_irq = entry->msi_attrib.default_irq;
+	msi_free_irq(dev, dev->first_msi_irq);
+
+	/* Restore dev->irq to its default pin-assertion irq */
+	dev->irq = default_irq;
+
 	dev->first_msi_irq = 0;
 }