[DECNET]: Use kzalloc where applicable
authorArnaldo Carvalho de Melo <acme@mandriva.com>
Tue, 21 Nov 2006 03:16:24 +0000 (01:16 -0200)
committerDavid S. Miller <davem@sunset.davemloft.net>
Sun, 3 Dec 2006 05:30:15 +0000 (21:30 -0800)
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
net/decnet/dn_table.c

index 9ce58c24a8d3d4fd02c9ce44c2759f2cbe626bb6..bdbc3f431668b3ff5765e06c0e92a16f804682e9 100644 (file)
@@ -831,10 +831,11 @@ struct dn_fib_table *dn_fib_get_table(u32 n, int create)
                 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(u32 n, int create)
         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;