aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2005-10-14 18:29:48 -0400
committerArnaldo Carvalho de Melo <acme@mandriva.com>2005-10-25 22:05:32 -0400
commit2845b63b504b051a9cb4d78bed8b3594451a1f6f (patch)
tree6de91ce8e5c07ec3bfd670605e8de916eec3b9ad /net/core
parentb7c8921bf1a8a9c1907b1eeb029d3f167be226f3 (diff)
[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/core')
-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)
2869 2869
2870 if( (pkt_dev = __pktgen_NN_threads(ifname, FIND)) == NULL) { 2870 if( (pkt_dev = __pktgen_NN_threads(ifname, FIND)) == NULL) {
2871 2871
2872 pkt_dev = kmalloc(sizeof(struct pktgen_dev), GFP_KERNEL); 2872 pkt_dev = kzalloc(sizeof(struct pktgen_dev), GFP_KERNEL);
2873 if (!pkt_dev) 2873 if (!pkt_dev)
2874 return -ENOMEM; 2874 return -ENOMEM;
2875 2875
2876 memset(pkt_dev, 0, sizeof(struct pktgen_dev));
2877
2878 pkt_dev->flows = vmalloc(MAX_CFLOWS*sizeof(struct flow_state)); 2876 pkt_dev->flows = vmalloc(MAX_CFLOWS*sizeof(struct flow_state));
2879 if (pkt_dev->flows == NULL) { 2877 if (pkt_dev->flows == NULL) {
2880 kfree(pkt_dev); 2878 kfree(pkt_dev);
@@ -2958,13 +2956,12 @@ static int pktgen_create_thread(const char* name, int cpu)
2958 return -EINVAL; 2956 return -EINVAL;
2959 } 2957 }
2960 2958
2961 t = (struct pktgen_thread*)(kmalloc(sizeof(struct pktgen_thread), GFP_KERNEL)); 2959 t = kzalloc(sizeof(struct pktgen_thread), GFP_KERNEL);
2962 if (!t) { 2960 if (!t) {
2963 printk("pktgen: ERROR: out of memory, can't create new thread.\n"); 2961 printk("pktgen: ERROR: out of memory, can't create new thread.\n");
2964 return -ENOMEM; 2962 return -ENOMEM;
2965 } 2963 }
2966 2964
2967 memset(t, 0, sizeof(struct pktgen_thread));
2968 strcpy(t->name, name); 2965 strcpy(t->name, name);
2969 spin_lock_init(&t->if_lock); 2966 spin_lock_init(&t->if_lock);
2970 t->cpu = cpu; 2967 t->cpu = cpu;