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/mga_dma.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'shared-core/mga_dma.c') diff --git a/shared-core/mga_dma.c b/shared-core/mga_dma.c index 5e95c9f9..96fd97ff 100644 --- a/shared-core/mga_dma.c +++ b/shared-core/mga_dma.c @@ -642,9 +642,12 @@ int mga_do_cleanup_dma( drm_device_t *dev ) if ( dev->dev_private ) { drm_mga_private_t *dev_priv = dev->dev_private; - DRM_IOREMAPFREE( dev_priv->warp ); - DRM_IOREMAPFREE( dev_priv->primary ); - DRM_IOREMAPFREE( dev_priv->buffers ); + if ( dev_priv->warp != NULL ) + DRM_IOREMAPFREE( dev_priv->warp ); + if ( dev_priv->primary != NULL ) + DRM_IOREMAPFREE( dev_priv->primary ); + if ( dev_priv->buffers != NULL ) + DRM_IOREMAPFREE( dev_priv->buffers ); if ( dev_priv->head != NULL ) { mga_freelist_cleanup( dev ); -- cgit v1.2.3