* [KJ] replacing kmalloc with kzalloc in drivers/net/sb1250-mac.c
@ 2007-08-13 9:58 Surya Prabhakar N
2007-08-13 15:24 ` Robert P. J. Day
0 siblings, 1 reply; 2+ messages in thread
From: Surya Prabhakar N @ 2007-08-13 9:58 UTC (permalink / raw)
To: netdev; +Cc: Linux Kernel, Linux Kernel
Hi,
Replacing kmalloc with kzalloc and cleaning up memset in
drivers/net/sb1250-mac.c
Signed-off-by: Surya Prabhakar <surya.prabhakar@wipro.com>
---
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index e7fdcf1..2dca5a7 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -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.
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [KJ] replacing kmalloc with kzalloc in drivers/net/sb1250-mac.c
2007-08-13 9:58 [KJ] replacing kmalloc with kzalloc in drivers/net/sb1250-mac.c Surya Prabhakar N
@ 2007-08-13 15:24 ` Robert P. J. Day
0 siblings, 0 replies; 2+ messages in thread
From: Robert P. J. Day @ 2007-08-13 15:24 UTC (permalink / raw)
To: Surya Prabhakar N; +Cc: netdev, Linux Kernel
On Mon, 13 Aug 2007, Surya Prabhakar N wrote:
> Hi,
> Replacing kmalloc with kzalloc and cleaning up memset in
> drivers/net/sb1250-mac.c
>
>
> Signed-off-by: Surya Prabhakar <surya.prabhakar@wipro.com>
> ---
>
> diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
> index e7fdcf1..2dca5a7 100644
> --- a/drivers/net/sb1250-mac.c
> +++ b/drivers/net/sb1250-mac.c
> @@ -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);
i'm fairly sure you can drop all of those superfluous casts when
calling one of those memory allocation routines.
rday
--
========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry
Waterloo, Ontario, CANADA
http://fsdev.net/wiki/index.php?title=Main_Page
========================================================================
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-08-13 15:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-13 9:58 [KJ] replacing kmalloc with kzalloc in drivers/net/sb1250-mac.c Surya Prabhakar N
2007-08-13 15:24 ` Robert P. J. Day
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox