Move the deallocation of dev_private. Since dev_private is allocated when
authorIan Romanick <idr@us.ibm.com>
Fri, 3 Jun 2005 22:45:21 +0000 (22:45 +0000)
committerIan Romanick <idr@us.ibm.com>
Fri, 3 Jun 2005 22:45:21 +0000 (22:45 +0000)
    the driver is loaded and is always expected to be around, it should
    only be deallocated when the driver is unloaded.
Xorg bug: #3408 Reported by: Chris Rankin

shared-core/mga_dma.c

index 2adb30a..367c670 100644 (file)
@@ -572,10 +572,6 @@ static int mga_do_cleanup_dma(drm_device_t * dev)
                if (dev_priv->head != NULL) {
                        mga_freelist_cleanup(dev);
                }
-
-               drm_free(dev->dev_private, sizeof(drm_mga_private_t),
-                        DRM_MEM_DRIVER);
-               dev->dev_private = NULL;
        }
 
        return 0;
@@ -723,7 +719,17 @@ int mga_dma_buffers(DRM_IOCTL_ARGS)
 
 int mga_driver_postcleanup(drm_device_t * dev)
 {
-       return mga_do_cleanup_dma(dev);
+       int err;
+       
+       
+       err = mga_do_cleanup_dma(dev);
+       if (!err) {
+               drm_free(dev->dev_private, sizeof(drm_mga_private_t),
+                        DRM_MEM_DRIVER);
+               dev->dev_private = NULL;
+       }
+
+       return err;
 }
 
 int mga_driver_dma_quiescent(drm_device_t * dev)