Clean up extra zeroing of dev->dma, and use calloc to take advantage of

M_ZERO.
This commit is contained in:
Eric Anholt 2003-10-19 22:29:08 +00:00
parent 63ce8af555
commit 59fbe01fea
2 changed files with 4 additions and 16 deletions

View file

@ -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;
}

View file

@ -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;
}