Skip to contentSkip to conversation

: Use kzalloc where applicable

PATCH In review Arnaldo Carvalho de Melo 1 participant 1 message Nov 21, 2006

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

PATCH 4/11 : Use kzalloc where applicable

---
 net/decnet/dn_table.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
net/decnet/dn_table.c +4 -4
index 9ce58c2..bdbc3f4 100644
@@ -831,10 +831,11 @@ struct dn_fib_table *dn_fib_get_table(u3
                 printk(KERN_DEBUG "DECnet: BUG! Attempt to create routing table from interrupt\n"); 
                 return NULL;
         }
-        if ((t = kmalloc(sizeof(struct dn_fib_table) + sizeof(struct dn_hash), GFP_KERNEL)) == NULL)
-                return NULL;
 
-        memset(t, 0, sizeof(struct dn_fib_table));
+        t = kzalloc(sizeof(struct dn_fib_table) + sizeof(struct dn_hash),
+		    GFP_KERNEL);
+        if (t == NULL)
+                return NULL;
 
         t->n = n;
         t->insert = dn_fib_table_insert;
@@ -842,7 +843,6 @@ struct dn_fib_table *dn_fib_get_table(u3
         t->lookup = dn_fib_table_lookup;
         t->flush  = dn_fib_table_flush;
         t->dump = dn_fib_table_dump;
-	memset(t->data, 0, sizeof(struct dn_hash));
 	hlist_add_head_rcu(&t->hlist, &dn_fib_table_hash[h]);
 
         return t;
Signature · 1 line
1.4.2.1.g3d5c