Destroy the /dev device before destroying the mutex or releasing resources

rather than afterwards.

MFC after:	1 week
This commit is contained in:
jhb 2005-12-20 20:03:16 +00:00
parent 619a2b9cae
commit 91b174b0da
2 changed files with 4 additions and 2 deletions

View File

@ -253,9 +253,10 @@ int
agp_generic_detach(device_t dev) agp_generic_detach(device_t dev)
{ {
struct agp_softc *sc = device_get_softc(dev); struct agp_softc *sc = device_get_softc(dev);
destroy_dev(sc->as_devnode);
bus_release_resource(dev, SYS_RES_MEMORY, AGP_APBASE, sc->as_aperture); bus_release_resource(dev, SYS_RES_MEMORY, AGP_APBASE, sc->as_aperture);
mtx_destroy(&sc->as_lock); mtx_destroy(&sc->as_lock);
destroy_dev(sc->as_devnode);
agp_flush_cache(); agp_flush_cache();
return 0; return 0;
} }

View File

@ -253,9 +253,10 @@ int
agp_generic_detach(device_t dev) agp_generic_detach(device_t dev)
{ {
struct agp_softc *sc = device_get_softc(dev); struct agp_softc *sc = device_get_softc(dev);
destroy_dev(sc->as_devnode);
bus_release_resource(dev, SYS_RES_MEMORY, AGP_APBASE, sc->as_aperture); bus_release_resource(dev, SYS_RES_MEMORY, AGP_APBASE, sc->as_aperture);
mtx_destroy(&sc->as_lock); mtx_destroy(&sc->as_lock);
destroy_dev(sc->as_devnode);
agp_flush_cache(); agp_flush_cache();
return 0; return 0;
} }