powerpc/MSI: Fix race condition in tearing down MSI interrupts
[pandora-kernel.git] / arch / powerpc / platforms / powernv / pci.c
index 85bb66d..15a05ca 100644 (file)
@@ -130,6 +130,7 @@ static void pnv_teardown_msi_irqs(struct pci_dev *pdev)
        struct pci_controller *hose = pci_bus_to_host(pdev->bus);
        struct pnv_phb *phb = hose->private_data;
        struct msi_desc *entry;
+       irq_hw_number_t hwirq;
 
        if (WARN_ON(!phb))
                return;
@@ -137,9 +138,10 @@ static void pnv_teardown_msi_irqs(struct pci_dev *pdev)
        list_for_each_entry(entry, &pdev->msi_list, list) {
                if (entry->irq == NO_IRQ)
                        continue;
+               hwirq = virq_to_hw(entry->irq);
                irq_set_msi_desc(entry->irq, NULL);
-               pnv_put_msi(phb, virq_to_hw(entry->irq));
                irq_dispose_mapping(entry->irq);
+               pnv_put_msi(phb, hwirq);
        }
 }
 #endif /* CONFIG_PCI_MSI */