From 828ae3f6b88b5a69a56b2961307e40ed95edea29 Mon Sep 17 00:00:00 2001 From: Robert Noland Date: Mon, 8 Sep 2008 16:40:52 -0400 Subject: [FreeBSD] We need to call drm_detach before we free dev->driver. The driver is in control of the show, so when you try and unload a module the driver detach routine is called first. It is what drives the whole unload process and so lots of panics occur if dev->driver is already free. --- bsd-core/mga_drv.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'bsd-core/mga_drv.c') diff --git a/bsd-core/mga_drv.c b/bsd-core/mga_drv.c index 7abf2b03..85809609 100644 --- a/bsd-core/mga_drv.c +++ b/bsd-core/mga_drv.c @@ -142,10 +142,13 @@ static int mga_detach(device_t nbdev) { struct drm_device *dev = device_get_softc(nbdev); + int ret; + + ret = drm_detach(nbdev); free(dev->driver, M_DRM); - return drm_detach(nbdev); + return ret; } static device_method_t mga_methods[] = { -- cgit v1.2.3