DragonFlyBSD Kernel Audit
DF-1820 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/raid/amr/amr_pci.c b/sys/dev/raid/amr/amr_pci.c
--- a/sys/dev/raid/amr/amr_pci.c
+++ b/sys/dev/raid/amr/amr_pci.c
@@ -481,6 +481,12 @@
 
     debug_called(1);
 
+    /* disconnect the interrupt handler */
+    if (sc->amr_intr)
+	bus_teardown_intr(sc->amr_dev, sc->amr_irq, sc->amr_intr);
+    if (sc->amr_irq != NULL)
+	bus_release_resource(sc->amr_dev, SYS_RES_IRQ, 0, sc->amr_irq);
+
     amr_free(sc);
 
     /* destroy data-transfer DMA tag */
@@ -509,12 +515,6 @@
     if (sc->amr_mailbox_dmat)
 	bus_dma_tag_destroy(sc->amr_mailbox_dmat);
 
-    /* disconnect the interrupt handler */
-    if (sc->amr_intr)
-	bus_teardown_intr(sc->amr_dev, sc->amr_irq, sc->amr_intr);
-    if (sc->amr_irq != NULL)
-	bus_release_resource(sc->amr_dev, SYS_RES_IRQ, 0, sc->amr_irq);
-
     /* destroy the parent DMA tag */
     if (sc->amr_parent_dmat)
 	bus_dma_tag_destroy(sc->amr_parent_dmat);