Commit 2710b57f authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo Committed by David S. Miller

[TIPC]: Use kzalloc where appropriate

Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@mandriva.com>
parent e69062b4
...@@ -774,8 +774,8 @@ int tipc_bclink_set_queue_limits(u32 limit) ...@@ -774,8 +774,8 @@ int tipc_bclink_set_queue_limits(u32 limit)
int tipc_bclink_init(void) int tipc_bclink_init(void)
{ {
bcbearer = kmalloc(sizeof(*bcbearer), GFP_ATOMIC); bcbearer = kzalloc(sizeof(*bcbearer), GFP_ATOMIC);
bclink = kmalloc(sizeof(*bclink), GFP_ATOMIC); bclink = kzalloc(sizeof(*bclink), GFP_ATOMIC);
if (!bcbearer || !bclink) { if (!bcbearer || !bclink) {
nomem: nomem:
warn("Multicast link creation failed, no memory\n"); warn("Multicast link creation failed, no memory\n");
...@@ -786,14 +786,12 @@ int tipc_bclink_init(void) ...@@ -786,14 +786,12 @@ int tipc_bclink_init(void)
return -ENOMEM; return -ENOMEM;
} }
memset(bcbearer, 0, sizeof(struct bcbearer));
INIT_LIST_HEAD(&bcbearer->bearer.cong_links); INIT_LIST_HEAD(&bcbearer->bearer.cong_links);
bcbearer->bearer.media = &bcbearer->media; bcbearer->bearer.media = &bcbearer->media;
bcbearer->media.send_msg = tipc_bcbearer_send; bcbearer->media.send_msg = tipc_bcbearer_send;
sprintf(bcbearer->media.name, "tipc-multicast"); sprintf(bcbearer->media.name, "tipc-multicast");
bcl = &bclink->link; bcl = &bclink->link;
memset(bclink, 0, sizeof(struct bclink));
INIT_LIST_HEAD(&bcl->waiting_ports); INIT_LIST_HEAD(&bcl->waiting_ports);
bcl->next_out_no = 1; bcl->next_out_no = 1;
spin_lock_init(&bclink->node.lock); spin_lock_init(&bclink->node.lock);
......
...@@ -60,7 +60,7 @@ struct node *tipc_node_create(u32 addr) ...@@ -60,7 +60,7 @@ struct node *tipc_node_create(u32 addr)
struct node *n_ptr; struct node *n_ptr;
struct node **curr_node; struct node **curr_node;
n_ptr = kmalloc(sizeof(*n_ptr),GFP_ATOMIC); n_ptr = kzalloc(sizeof(*n_ptr),GFP_ATOMIC);
if (!n_ptr) { if (!n_ptr) {
warn("Node creation failed, no memory\n"); warn("Node creation failed, no memory\n");
return NULL; return NULL;
...@@ -75,7 +75,6 @@ struct node *tipc_node_create(u32 addr) ...@@ -75,7 +75,6 @@ struct node *tipc_node_create(u32 addr)
return NULL; return NULL;
} }
memset(n_ptr, 0, sizeof(*n_ptr));
n_ptr->addr = addr; n_ptr->addr = addr;
spin_lock_init(&n_ptr->lock); spin_lock_init(&n_ptr->lock);
INIT_LIST_HEAD(&n_ptr->nsub); INIT_LIST_HEAD(&n_ptr->nsub);
......
...@@ -350,7 +350,7 @@ static void subscr_subscribe(struct tipc_subscr *s, ...@@ -350,7 +350,7 @@ static void subscr_subscribe(struct tipc_subscr *s,
/* Allocate subscription object */ /* Allocate subscription object */
sub = kmalloc(sizeof(*sub), GFP_ATOMIC); sub = kzalloc(sizeof(*sub), GFP_ATOMIC);
if (!sub) { if (!sub) {
warn("Subscription rejected, no memory\n"); warn("Subscription rejected, no memory\n");
subscr_terminate(subscriber); subscr_terminate(subscriber);
...@@ -359,7 +359,6 @@ static void subscr_subscribe(struct tipc_subscr *s, ...@@ -359,7 +359,6 @@ static void subscr_subscribe(struct tipc_subscr *s,
/* Initialize subscription object */ /* Initialize subscription object */
memset(sub, 0, sizeof(*sub));
sub->seq.type = htohl(s->seq.type, subscriber->swap); sub->seq.type = htohl(s->seq.type, subscriber->swap);
sub->seq.lower = htohl(s->seq.lower, subscriber->swap); sub->seq.lower = htohl(s->seq.lower, subscriber->swap);
sub->seq.upper = htohl(s->seq.upper, subscriber->swap); sub->seq.upper = htohl(s->seq.upper, subscriber->swap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment