Skip to contentSkip to conversation

drivers/net/cxgb3: Use kzalloc for allocating only one thing

PATCH Applied Julia Lawall 3 participants 3 messages Dec 19, 2009 – Jan 4, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 3/7 drivers/net/cxgb3: Use kzalloc for allocating only one thing

From: Julia Lawall <[email protected]>

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>

---
 drivers/net/cxgb3/cxgb3_offload.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/cxgb3/cxgb3_offload.c 2009-12-19 07:52:52.000000000 +0100 renamed from drivers/net/cxgb3/cxgb3_offload.c 2009-09-14 14:55:49.000000000 +0200 +1 -1
diff -u -p a/drivers/net/cxgb3/cxgb3_offload.c b/drivers/net/cxgb3/cxgb3_offload.c
@@ -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;
 
Acked-by on v1 3/7
#1 lore raw
Quoted 12 lines · Julia Lawall

From: Julia Lawall <[email protected]>

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

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

// <smpl>
@@
@@

Quoted 7 lines

- kcalloc(1,
+ kzalloc(

          ...)

// </smpl>

Quoted 20 lines
---
 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

drivers/net/cxgb3/cxgb3_offload.c 2009-12-19 07:52:52.000000000 +0100 renamed from drivers/net/cxgb3/cxgb3_offload.c 2009-09-14 14:55:49.000000000 +0200 +1 -1
@@ -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;