summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeif Delgass <ldelgass@users.sourceforge.net>2003-04-21 16:07:17 +0000
committerLeif Delgass <ldelgass@users.sourceforge.net>2003-04-21 16:07:17 +0000
commit46e06192a88834a97257d2be5ab3aa7c325a1cfe (patch)
tree3a77c3f79e6415aaff35c6fbd22f256269ced8a0
parentda35a90d99cf56a8ffc48f87754013d13e1cafcd (diff)
Check for NULL map before calling DRM(ioremapfree) on cleanup. Prevents an
oops if a map wasn't found (e.g. XFree86 Bugzilla #108)
-rw-r--r--linux-core/i810_dma.c3
-rw-r--r--linux-core/i830_dma.c3
-rw-r--r--linux/gamma_dma.c3
-rw-r--r--linux/i810_dma.c3
-rw-r--r--linux/i830_dma.c3
-rw-r--r--shared-core/mga_dma.c9
-rw-r--r--shared-core/r128_cce.c9
-rw-r--r--shared-core/radeon_cp.c9
-rw-r--r--shared/mga_dma.c9
-rw-r--r--shared/r128_cce.c9
-rw-r--r--shared/radeon_cp.c9
11 files changed, 46 insertions, 23 deletions
diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c
index b0a1b6aa..c06fd915 100644
--- a/linux-core/i810_dma.c
+++ b/linux-core/i810_dma.c
@@ -263,7 +263,8 @@ static int i810_dma_cleanup(drm_device_t *dev)
for (i = 0; i < dma->buf_count; i++) {
drm_buf_t *buf = dma->buflist[ i ];
drm_i810_buf_priv_t *buf_priv = buf->dev_private;
- DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total);
+ if ( buf_priv->kernel_virtual && buf->total )
+ DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total);
}
}
return 0;
diff --git a/linux-core/i830_dma.c b/linux-core/i830_dma.c
index 1018fdcb..b76d2b11 100644
--- a/linux-core/i830_dma.c
+++ b/linux-core/i830_dma.c
@@ -280,7 +280,8 @@ static int i830_dma_cleanup(drm_device_t *dev)
for (i = 0; i < dma->buf_count; i++) {
drm_buf_t *buf = dma->buflist[ i ];
drm_i830_buf_priv_t *buf_priv = buf->dev_private;
- DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total);
+ if ( buf_priv->kernel_virtual && buf->total )
+ DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total);
}
}
return 0;
diff --git a/linux/gamma_dma.c b/linux/gamma_dma.c
index 6734f1c4..cf25aaba 100644
--- a/linux/gamma_dma.c
+++ b/linux/gamma_dma.c
@@ -673,7 +673,8 @@ int gamma_do_cleanup_dma( drm_device_t *dev )
if ( dev->dev_private ) {
drm_gamma_private_t *dev_priv = dev->dev_private;
- DRM_IOREMAPFREE( dev_priv->buffers );
+ if ( dev_priv->buffers != NULL )
+ DRM_IOREMAPFREE( dev_priv->buffers );
DRM(free)( dev->dev_private, sizeof(drm_gamma_private_t),
DRM_MEM_DRIVER );
diff --git a/linux/i810_dma.c b/linux/i810_dma.c
index b0a1b6aa..c06fd915 100644
--- a/linux/i810_dma.c
+++ b/linux/i810_dma.c
@@ -263,7 +263,8 @@ static int i810_dma_cleanup(drm_device_t *dev)
for (i = 0; i < dma->buf_count; i++) {
drm_buf_t *buf = dma->buflist[ i ];
drm_i810_buf_priv_t *buf_priv = buf->dev_private;
- DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total);
+ if ( buf_priv->kernel_virtual && buf->total )
+ DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total);
}
}
return 0;
diff --git a/linux/i830_dma.c b/linux/i830_dma.c
index 1018fdcb..b76d2b11 100644
--- a/linux/i830_dma.c
+++ b/linux/i830_dma.c
@@ -280,7 +280,8 @@ static int i830_dma_cleanup(drm_device_t *dev)
for (i = 0; i < dma->buf_count; i++) {
drm_buf_t *buf = dma->buflist[ i ];
drm_i830_buf_priv_t *buf_priv = buf->dev_private;
- DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total);
+ if ( buf_priv->kernel_virtual && buf->total )
+ DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total);
}
}
return 0;
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 );
diff --git a/shared-core/r128_cce.c b/shared-core/r128_cce.c
index 7f0f4325..ad03f4f9 100644
--- a/shared-core/r128_cce.c
+++ b/shared-core/r128_cce.c
@@ -619,9 +619,12 @@ int r128_do_cleanup_cce( drm_device_t *dev )
#if __REALLY_HAVE_SG
if ( !dev_priv->is_pci ) {
#endif
- DRM_IOREMAPFREE( dev_priv->cce_ring );
- DRM_IOREMAPFREE( dev_priv->ring_rptr );
- DRM_IOREMAPFREE( dev_priv->buffers );
+ if ( dev_priv->cce_ring != NULL )
+ DRM_IOREMAPFREE( dev_priv->cce_ring );
+ if ( dev_priv->ring_rptr != NULL )
+ DRM_IOREMAPFREE( dev_priv->ring_rptr );
+ if ( dev_priv->buffers != NULL )
+ DRM_IOREMAPFREE( dev_priv->buffers );
#if __REALLY_HAVE_SG
} else {
if (!DRM(ati_pcigart_cleanup)( dev,
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,
diff --git a/shared/mga_dma.c b/shared/mga_dma.c
index 5e95c9f9..96fd97ff 100644
--- a/shared/mga_dma.c
+++ b/shared/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 );
diff --git a/shared/r128_cce.c b/shared/r128_cce.c
index 7f0f4325..ad03f4f9 100644
--- a/shared/r128_cce.c
+++ b/shared/r128_cce.c
@@ -619,9 +619,12 @@ int r128_do_cleanup_cce( drm_device_t *dev )
#if __REALLY_HAVE_SG
if ( !dev_priv->is_pci ) {
#endif
- DRM_IOREMAPFREE( dev_priv->cce_ring );
- DRM_IOREMAPFREE( dev_priv->ring_rptr );
- DRM_IOREMAPFREE( dev_priv->buffers );
+ if ( dev_priv->cce_ring != NULL )
+ DRM_IOREMAPFREE( dev_priv->cce_ring );
+ if ( dev_priv->ring_rptr != NULL )
+ DRM_IOREMAPFREE( dev_priv->ring_rptr );
+ if ( dev_priv->buffers != NULL )
+ DRM_IOREMAPFREE( dev_priv->buffers );
#if __REALLY_HAVE_SG
} else {
if (!DRM(ati_pcigart_cleanup)( dev,
diff --git a/shared/radeon_cp.c b/shared/radeon_cp.c
index 3ec8dfd1..ee4beb1a 100644
--- a/shared/radeon_cp.c
+++ b/shared/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,