summaryrefslogtreecommitdiffstats
path: root/net/tipc/cluster.c
diff options
context:
space:
mode:
authorPanagiotis Issaris <takis@issaris.org>2006-07-21 14:51:30 -0700
committerDavid S. Miller <davem@davemloft.net>2006-07-21 14:51:30 -0700
commit0da974f4f303a6842516b764507e3c0a03f41e5a (patch)
tree8872aec792f02040269c6769dd1009b20f71d186 /net/tipc/cluster.c
parenta0ee7c70b22f78593957f99faa06acb4747b8bc0 (diff)
downloadlinux-0da974f4f303a6842516b764507e3c0a03f41e5a.tar.bz2
[NET]: Conversions from kmalloc+memset to k(z|c)alloc.
Signed-off-by: Panagiotis Issaris <takis@issaris.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/cluster.c')
-rw-r--r--net/tipc/cluster.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/net/tipc/cluster.c b/net/tipc/cluster.c
index 1dcb6940e338..b46b5188a9fd 100644
--- a/net/tipc/cluster.c
+++ b/net/tipc/cluster.c
@@ -57,29 +57,25 @@ struct cluster *tipc_cltr_create(u32 addr)
struct _zone *z_ptr;
struct cluster *c_ptr;
int max_nodes;
- int alloc;
- c_ptr = (struct cluster *)kmalloc(sizeof(*c_ptr), GFP_ATOMIC);
+ c_ptr = kzalloc(sizeof(*c_ptr), GFP_ATOMIC);
if (c_ptr == NULL) {
warn("Cluster creation failure, no memory\n");
return NULL;
}
- memset(c_ptr, 0, sizeof(*c_ptr));
c_ptr->addr = tipc_addr(tipc_zone(addr), tipc_cluster(addr), 0);
if (in_own_cluster(addr))
max_nodes = LOWEST_SLAVE + tipc_max_slaves;
else
max_nodes = tipc_max_nodes + 1;
- alloc = sizeof(void *) * (max_nodes + 1);
- c_ptr->nodes = (struct node **)kmalloc(alloc, GFP_ATOMIC);
+ c_ptr->nodes = kcalloc(max_nodes + 1, sizeof(void*), GFP_ATOMIC);
if (c_ptr->nodes == NULL) {
warn("Cluster creation failure, no memory for node area\n");
kfree(c_ptr);
return NULL;
}
- memset(c_ptr->nodes, 0, alloc);
if (in_own_cluster(addr))
tipc_local_nodes = c_ptr->nodes;