The initialization in for loop can be removed as the SET_AGE macro
set the age struct and other members to zero.
Signed-off-by: Mariusz Kozlowski <[email protected]>
drivers/char/drm/savage_bci.c | 31888 -> 31634 (-254 bytes)
drivers/char/drm/savage_bci.o | 138936 -> 138984 (+48 bytes)
drivers/char/drm/savage_bci.c | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
--- linux-2.6.23-rc3-mm1.orig/drivers/char/drm/savage_bci.c
+++ linux-2.6.23-rc3-mm1/drivers/char/drm/savage_bci.c
@@ -294,20 +294,13 @@ void savage_freelist_put(struct drm_devi
*/
static int savage_dma_init(drm_savage_private_t * dev_priv)
{
- unsigned int i;
-
dev_priv->nr_dma_pages = dev_priv->cmd_dma->size /
(SAVAGE_DMA_PAGE_SIZE * 4);
- dev_priv->dma_pages = drm_alloc(sizeof(drm_savage_dma_page_t) *
- dev_priv->nr_dma_pages, DRM_MEM_DRIVER);
- if (dev_priv->dma_pages == NULL)
+ dev_priv->dma_pages = drm_calloc(dev_priv->nr_dma_pages,
+ sizeof(drm_savage_dma_page_t), DRM_MEM_DRIVER);
+ if (!dev_priv->dma_pages)
return DRM_ERR(ENOMEM);
- for (i = 0; i < dev_priv->nr_dma_pages; ++i) {
- SET_AGE(&dev_priv->dma_pages[i].age, 0, 0);
- dev_priv->dma_pages[i].used = 0;
- dev_priv->dma_pages[i].flushed = 0;
- }
SET_AGE(&dev_priv->last_dma_age, 0, 0);
dev_priv->first_dma_page = 0;
@@ -539,11 +532,10 @@ int savage_driver_load(struct drm_device
{
drm_savage_private_t *dev_priv;
- dev_priv = drm_alloc(sizeof(drm_savage_private_t), DRM_MEM_DRIVER);
- if (dev_priv == NULL)
+ dev_priv = drm_zalloc(sizeof(drm_savage_private_t), DRM_MEM_DRIVER);
+ if (!dev_priv)
return DRM_ERR(ENOMEM);
- memset(dev_priv, 0, sizeof(drm_savage_private_t));
dev->dev_private = (void *)dev_priv;
dev_priv->chipset = (enum savage_family)chipset;
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]