summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2005-10-15 02:29:48 +0400
committerArnaldo Carvalho de Melo <acme@mandriva.com>2005-10-26 06:05:32 +0400
commit2845b63b504b051a9cb4d78bed8b3594451a1f6f (patch)
tree6de91ce8e5c07ec3bfd670605e8de916eec3b9ad /net
parentb7c8921bf1a8a9c1907b1eeb029d3f167be226f3 (diff)
downloadlinux-2845b63b504b051a9cb4d78bed8b3594451a1f6f.tar.xz
[PKTGEN]: Use kzalloc
These are cleanup patches for pktgen that can go in 2.6.15 Can use kzalloc in a couple of places. Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: Robert Olsson <robert.olsson@its.uu.se> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net')
-rw-r--r--net/core/pktgen.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 8a90bf79261a..b597ef1771f4 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -2869,12 +2869,10 @@ static int pktgen_add_device(struct pktgen_thread *t, const char* ifname)
if( (pkt_dev = __pktgen_NN_threads(ifname, FIND)) == NULL) {
- pkt_dev = kmalloc(sizeof(struct pktgen_dev), GFP_KERNEL);
+ pkt_dev = kzalloc(sizeof(struct pktgen_dev), GFP_KERNEL);
if (!pkt_dev)
return -ENOMEM;
- memset(pkt_dev, 0, sizeof(struct pktgen_dev));
-
pkt_dev->flows = vmalloc(MAX_CFLOWS*sizeof(struct flow_state));
if (pkt_dev->flows == NULL) {
kfree(pkt_dev);
@@ -2958,13 +2956,12 @@ static int pktgen_create_thread(const char* name, int cpu)
return -EINVAL;
}
- t = (struct pktgen_thread*)(kmalloc(sizeof(struct pktgen_thread), GFP_KERNEL));
+ t = kzalloc(sizeof(struct pktgen_thread), GFP_KERNEL);
if (!t) {
printk("pktgen: ERROR: out of memory, can't create new thread.\n");
return -ENOMEM;
}
- memset(t, 0, sizeof(struct pktgen_thread));
strcpy(t->name, name);
spin_lock_init(&t->if_lock);
t->cpu = cpu;