twa(4)/twe(4): Move dev_ops_remove_minor() after destroy_dev().
authorSascha Wildner <saw@online.de>
Sun, 8 Jul 2012 23:07:10 +0000 (01:07 +0200)
committerSascha Wildner <saw@online.de>
Sun, 8 Jul 2012 23:07:10 +0000 (01:07 +0200)
Fixes crash on module unload.

sys/dev/raid/twa/tw_osl_freebsd.c
sys/dev/raid/twe/twe_freebsd.c

index 3b60cf1..e18c41d 100644 (file)
@@ -807,11 +807,10 @@ tw_osli_free_resources(struct twa_softc *sc)
                        tw_osli_dbg_dprintf(1, sc,
                                "release_resource(io) returned %d", error);
 
-       dev_ops_remove_minor(&twa_ops, device_get_unit(sc->bus_dev));
-
        /* Destroy the control device. */
        if (sc->ctrl_dev != NULL)
                destroy_dev(sc->ctrl_dev);
+       dev_ops_remove_minor(&twa_ops, device_get_unit(sc->bus_dev));
 
        if ((error = sysctl_ctx_free(&sc->sysctl_ctxt)))
                tw_osli_dbg_dprintf(1, sc,
index 7926a71..fa6bc11 100644 (file)
@@ -420,11 +420,10 @@ twe_free(struct twe_softc *sc)
     if (sc->twe_io != NULL)
        bus_release_resource(sc->twe_dev, SYS_RES_IOPORT, TWE_IO_CONFIG_REG, sc->twe_io);
 
-    dev_ops_remove_minor(&twe_ops, device_get_unit(sc->twe_dev));
-
     /* destroy control device */
     if (sc->twe_dev_t != NULL)
        destroy_dev(sc->twe_dev_t);
+    dev_ops_remove_minor(&twe_ops, device_get_unit(sc->twe_dev));
 
     sysctl_ctx_free(&sc->sysctl_ctx);
 }