Patchwork [3/7] drivers/net/cxgb3: Use kzalloc for allocating only one thing

login
register
mail settings
Submitter Julia Lawall
Date Dec. 19, 2009, 7:16 a.m.
Message ID <Pine.LNX.4.64.0912190816340.30546@ask.diku.dk>
Download mbox | patch
Permalink /patch/41463/
State Accepted
Delegated to: David Miller
Headers show

Comments

Julia Lawall - Dec. 19, 2009, 7:16 a.m.
From: Julia Lawall <julia@diku.dk>

Use kzalloc rather than kcalloc(1,...)

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
@@

- kcalloc(1,
+ kzalloc(
          ...)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>

---
 drivers/net/cxgb3/cxgb3_offload.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Divy Le Ray - Dec. 21, 2009, 11:33 p.m.
Julia Lawall wrote:
>
> From: Julia Lawall <julia@diku.dk>
>
> Use kzalloc rather than kcalloc(1,...)
>
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> @@
>
> - kcalloc(1,
> + kzalloc(
>           ...)
> // </smpl>
>
> Signed-off-by: Julia Lawall <julia@diku.dk>
>

Acked-by: Divy Le Ray <divy@chelsio.com>

>
> ---
>  drivers/net/cxgb3/cxgb3_offload.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff -u -p a/drivers/net/cxgb3/cxgb3_offload.c 
> b/drivers/net/cxgb3/cxgb3_offload.c
> --- a/drivers/net/cxgb3/cxgb3_offload.c 2009-09-14 14:55:49.000000000 
> +0200
> +++ b/drivers/net/cxgb3/cxgb3_offload.c 2009-12-19 07:52:52.000000000 
> +0100
> @@ -1252,7 +1252,7 @@ int cxgb3_offload_activate(struct adapte
>         struct mtutab mtutab;
>         unsigned int l2t_capacity;
>
> -       t = kcalloc(1, sizeof(*t), GFP_KERNEL);
> +       t = kzalloc(sizeof(*t), GFP_KERNEL);
>         if (!t)
>                 return -ENOMEM;
>


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Jan. 4, 2010, 5:22 a.m.
From: Divy Le Ray <divy@chelsio.com>
Date: Mon, 21 Dec 2009 15:33:41 -0800

> Julia Lawall wrote:
>>
>> From: Julia Lawall <julia@diku.dk>
>>
>> Use kzalloc rather than kcalloc(1,...)
 ...
>> Signed-off-by: Julia Lawall <julia@diku.dk>
>>
> 
> Acked-by: Divy Le Ray <divy@chelsio.com>

Applied to net-next-2.6, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff -u -p a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c
--- a/drivers/net/cxgb3/cxgb3_offload.c 2009-09-14 14:55:49.000000000 +0200
+++ b/drivers/net/cxgb3/cxgb3_offload.c 2009-12-19 07:52:52.000000000 +0100
@@ -1252,7 +1252,7 @@  int cxgb3_offload_activate(struct adapte
 	struct mtutab mtutab;
 	unsigned int l2t_capacity;
 
-	t = kcalloc(1, sizeof(*t), GFP_KERNEL);
+	t = kzalloc(sizeof(*t), GFP_KERNEL);
 	if (!t)
 		return -ENOMEM;