* [PATCH 6/20] drivers/net: Use kzalloc
@ 2010-05-13 20:00 Julia Lawall
2010-05-13 20:29 ` Lennert Buytenhek
2010-05-18 5:55 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Julia Lawall @ 2010-05-13 20:00 UTC (permalink / raw)
To: Lennert Buytenhek, netdev, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
Use kzalloc rather than the combination of kmalloc and memset.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@@
expression x,size,flags;
statement S;
@@
-x = kmalloc(size,flags);
+x = kzalloc(size,flags);
if (x == NULL) S
-memset(x, 0, size);
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
---
drivers/net/mv643xx_eth.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff -u -p a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c
--- a/drivers/net/mv643xx_eth.c
+++ b/drivers/net/mv643xx_eth.c
@@ -2608,10 +2608,9 @@ static int mv643xx_eth_shared_probe(stru
goto out;
ret = -ENOMEM;
- msp = kmalloc(sizeof(*msp), GFP_KERNEL);
+ msp = kzalloc(sizeof(*msp), GFP_KERNEL);
if (msp == NULL)
goto out;
- memset(msp, 0, sizeof(*msp));
msp->base = ioremap(res->start, res->end - res->start + 1);
if (msp->base == NULL)
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 6/20] drivers/net: Use kzalloc
2010-05-13 20:00 [PATCH 6/20] drivers/net: Use kzalloc Julia Lawall
@ 2010-05-13 20:29 ` Lennert Buytenhek
2010-05-18 5:55 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Lennert Buytenhek @ 2010-05-13 20:29 UTC (permalink / raw)
To: Julia Lawall; +Cc: netdev, linux-kernel, kernel-janitors
On Thu, May 13, 2010 at 10:00:22PM +0200, Julia Lawall wrote:
> From: Julia Lawall <julia@diku.dk>
>
> Use kzalloc rather than the combination of kmalloc and memset.
>
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> expression x,size,flags;
> statement S;
> @@
>
> -x = kmalloc(size,flags);
> +x = kzalloc(size,flags);
> if (x == NULL) S
> -memset(x, 0, size);
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
Acked-by: Lennert Buytenhek <buytenh@wantstofly.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 6/20] drivers/net: Use kzalloc
2010-05-13 20:00 [PATCH 6/20] drivers/net: Use kzalloc Julia Lawall
2010-05-13 20:29 ` Lennert Buytenhek
@ 2010-05-18 5:55 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2010-05-18 5:55 UTC (permalink / raw)
To: julia; +Cc: buytenh, netdev, linux-kernel, kernel-janitors
From: Julia Lawall <julia@diku.dk>
Date: Thu, 13 May 2010 22:00:22 +0200 (CEST)
> From: Julia Lawall <julia@diku.dk>
>
> Use kzalloc rather than the combination of kmalloc and memset.
>
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> expression x,size,flags;
> statement S;
> @@
>
> -x = kmalloc(size,flags);
> +x = kzalloc(size,flags);
> if (x == NULL) S
> -memset(x, 0, size);
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-05-18 5:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-13 20:00 [PATCH 6/20] drivers/net: Use kzalloc Julia Lawall
2010-05-13 20:29 ` Lennert Buytenhek
2010-05-18 5:55 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).