replacing kmalloc with kzalloc in drivers/net/sb1250-mac.c
Subsystems (2)
Hi,
Replacing kmalloc with kzalloc and cleaning up memset indrivers/net/sb1250-mac.c
Signed-off-by Surya Prabhakar <[email protected]>
---
drivers/net/sb1250-mac.c +2 -6
@@ -760,7 +760,7 @@ static void sbdma_initctx(sbmacdma_t *d, d->sbdma_dscrtable_unaligned = d->sbdma_dscrtable = (sbdmadscr_t *) -kmalloc ((d->sbdma_maxdescr+1 )*sizeof (sbdmadscr_t),GFP_KERNEL ); +kzalloc ((d->sbdma_maxdescr+1 )*sizeof (sbdmadscr_t),GFP_KERNEL );/* * The descriptor table must be aligned to at least 16 bytes or the
@@ -769,8 +769,6 @@ static void sbdma_initctx(sbmacdma_t *d, d->sbdma_dscrtable = (sbdmadscr_t *)ALIGN ((unsigned long )d->sbdma_dscrtable,sizeof (sbdmadscr_t)); -memset (d->sbdma_dscrtable,0 ,d->sbdma_maxdescr*sizeof (sbdmadscr_t)); - d->sbdma_dscrtable_end = d->sbdma_dscrtable + d->sbdma_maxdescr; d->sbdma_dscrtable_phys =virt_to_phys (d->sbdma_dscrtable);
@@ -780,9 +778,7 @@ static void sbdma_initctx(sbmacdma_t *d,*/ d->sbdma_ctxtable = (struct sk_buff **) -kmalloc (d->sbdma_maxdescr*sizeof (struct sk_buff *),GFP_KERNEL ); - -memset (d->sbdma_ctxtable,0 ,d->sbdma_maxdescr*sizeof (struct sk_buff *)); +kzalloc (d->sbdma_maxdescr*sizeof (struct sk_buff *),GFP_KERNEL );#ifdef CONFIG_SBMAC_COALESCE /*
--
thanks
surya.
Quoted 13 lines · Surya Prabhakar N
Hi,
Replacing kmalloc with kzalloc and cleaning up memset indrivers/net/sb1250-mac.cSigned-off-by Surya Prabhakar <[email protected]>---
drivers/net/sb1250-mac.c +0
-0
drivers/net/sb1250-mac.c static void sbdma_initctx(sbmacdma_t *d, · line 762
Quoted 3 lines
drivers/net/sb1250-mac.c +0
-0@@ -760,7 +760,7 @@ static void sbdma_initctx(sbmacdma_t *d, d->sbdma_dscrtable_unaligned = d->sbdma_dscrtable = (sbdmadscr_t *)
^^^^^^^^^^^^^^^
drivers/net/sb1250-mac.c static void sbdma_initctx(sbmacdma_t *d, · line 763
Quoted 2 lines
drivers/net/sb1250-mac.c +1
-1-kmalloc ((d->sbdma_maxdescr+1 )*sizeof (sbdmadscr_t),GFP_KERNEL ); +kzalloc ((d->sbdma_maxdescr+1 )*sizeof (sbdmadscr_t),GFP_KERNEL );
i'm fairly sure you can drop all of those superfluous casts when calling one of those memory allocation routines.
rday
Signature · 7 lines
======================================================================== Robert P. J. Day Linux Consulting, Training and Annoying Kernel Pedantry Waterloo, Ontario, CANADA http://fsdev.net/wiki/index.php?title=Main_Page ========================================================================