From 46e06192a88834a97257d2be5ab3aa7c325a1cfe Mon Sep 17 00:00:00 2001 From: Leif Delgass Date: Mon, 21 Apr 2003 16:07:17 +0000 Subject: Check for NULL map before calling DRM(ioremapfree) on cleanup. Prevents an oops if a map wasn't found (e.g. XFree86 Bugzilla #108) --- shared-core/radeon_cp.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'shared-core/radeon_cp.c') diff --git a/shared-core/radeon_cp.c b/shared-core/radeon_cp.c index 3ec8dfd1..ee4beb1a 100644 --- a/shared-core/radeon_cp.c +++ b/shared-core/radeon_cp.c @@ -1279,9 +1279,12 @@ int radeon_do_cleanup_cp( drm_device_t *dev ) drm_radeon_private_t *dev_priv = dev->dev_private; if ( !dev_priv->is_pci ) { - DRM_IOREMAPFREE( dev_priv->cp_ring ); - DRM_IOREMAPFREE( dev_priv->ring_rptr ); - DRM_IOREMAPFREE( dev_priv->buffers ); + if ( dev_priv->cp_ring != NULL ) + DRM_IOREMAPFREE( dev_priv->cp_ring ); + if ( dev_priv->ring_rptr != NULL ) + DRM_IOREMAPFREE( dev_priv->ring_rptr ); + if ( dev_priv->buffers != NULL ) + DRM_IOREMAPFREE( dev_priv->buffers ); } else { #if __REALLY_HAVE_SG if (!DRM(ati_pcigart_cleanup)( dev, -- cgit v1.2.3