summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anholt <anholt@freebsd.org>2003-10-19 22:29:08 +0000
committerEric Anholt <anholt@freebsd.org>2003-10-19 22:29:08 +0000
commit59fbe01fea8f77fc3810643c14a1738d197d4291 (patch)
tree6d42dfd6c0033c7fe01a5062a456e3edecee9ba7
parent63ce8af5550950b19db432230910e7a2424fa16f (diff)
Clean up extra zeroing of dev->dma, and use calloc to take advantage of
M_ZERO.
-rw-r--r--bsd-core/drm_dma.c10
-rw-r--r--bsd/drm_dma.h10
2 files changed, 4 insertions, 16 deletions
diff --git a/bsd-core/drm_dma.c b/bsd-core/drm_dma.c
index 877fd4e1..d5852403 100644
--- a/bsd-core/drm_dma.c
+++ b/bsd-core/drm_dma.c
@@ -46,17 +46,11 @@
int DRM(dma_setup)( drm_device_t *dev )
{
- int i;
- dev->dma = DRM(alloc)( sizeof(*dev->dma), DRM_MEM_DRIVER );
- if ( !dev->dma )
+ dev->dma = DRM(calloc)(1, sizeof(*dev->dma), DRM_MEM_DRIVER);
+ if (dev->dma == NULL)
return DRM_ERR(ENOMEM);
- memset( dev->dma, 0, sizeof(*dev->dma) );
-
- for ( i = 0 ; i <= DRM_MAX_ORDER ; i++ )
- memset(&dev->dma->bufs[i], 0, sizeof(dev->dma->bufs[0]));
-
return 0;
}
diff --git a/bsd/drm_dma.h b/bsd/drm_dma.h
index 877fd4e1..d5852403 100644
--- a/bsd/drm_dma.h
+++ b/bsd/drm_dma.h
@@ -46,17 +46,11 @@
int DRM(dma_setup)( drm_device_t *dev )
{
- int i;
- dev->dma = DRM(alloc)( sizeof(*dev->dma), DRM_MEM_DRIVER );
- if ( !dev->dma )
+ dev->dma = DRM(calloc)(1, sizeof(*dev->dma), DRM_MEM_DRIVER);
+ if (dev->dma == NULL)
return DRM_ERR(ENOMEM);
- memset( dev->dma, 0, sizeof(*dev->dma) );
-
- for ( i = 0 ; i <= DRM_MAX_ORDER ; i++ )
- memset(&dev->dma->bufs[i], 0, sizeof(dev->dma->bufs[0]));
-
return 0;
}