]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
tipc: Enhancements to name table initialization
authorAllan Stephens <allan.stephens@windriver.com>
Mon, 12 May 2008 22:41:53 +0000 (15:41 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 12 May 2008 22:41:53 +0000 (15:41 -0700)
This patch enhances the initialization of TIPC's name table
by removing a pointless spinlock operation, and by using
kcalloc() to detect requests for an oversized name table.

Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/tipc/name_table.c

index ac7dfdda79737f652e540dfd0297611a986aba12..892373e498e4865026b50fb9830ca51d7a7584fb 100644 (file)
@@ -1050,15 +1050,12 @@ void tipc_nametbl_dump(void)
 
 int tipc_nametbl_init(void)
 {
-       int array_size = sizeof(struct hlist_head) * tipc_nametbl_size;
-
-       table.types = kzalloc(array_size, GFP_ATOMIC);
+       table.types = kcalloc(tipc_nametbl_size, sizeof(struct hlist_head),
+                             GFP_ATOMIC);
        if (!table.types)
                return -ENOMEM;
 
-       write_lock_bh(&tipc_nametbl_lock);
        table.local_publ_count = 0;
-       write_unlock_bh(&tipc_nametbl_lock);
        return 0;
 }