aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@mandriva.com>2006-11-20 22:22:12 -0500
committerDavid S. Miller <davem@sunset.davemloft.net>2006-12-03 00:30:21 -0500
commit2710b57ff9b1437cfbe96b23ae86fedf3239f1ca (patch)
tree6395382004f63722a23e13d8997362104a91243d /net/tipc
parente69062b4f728dca01ec1a9eb4ed55b73a374f164 (diff)
[TIPC]: Use kzalloc where appropriate
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net/tipc')
-rw-r--r--net/tipc/bcast.c6
-rw-r--r--net/tipc/node.c3
-rw-r--r--net/tipc/subscr.c3
3 files changed, 4 insertions, 8 deletions
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 1bb75703f384..730c5c47ed8d 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -774,8 +774,8 @@ int tipc_bclink_set_queue_limits(u32 limit)
774 774
775int tipc_bclink_init(void) 775int tipc_bclink_init(void)
776{ 776{
777 bcbearer = kmalloc(sizeof(*bcbearer), GFP_ATOMIC); 777 bcbearer = kzalloc(sizeof(*bcbearer), GFP_ATOMIC);
778 bclink = kmalloc(sizeof(*bclink), GFP_ATOMIC); 778 bclink = kzalloc(sizeof(*bclink), GFP_ATOMIC);
779 if (!bcbearer || !bclink) { 779 if (!bcbearer || !bclink) {
780 nomem: 780 nomem:
781 warn("Multicast link creation failed, no memory\n"); 781 warn("Multicast link creation failed, no memory\n");
@@ -786,14 +786,12 @@ int tipc_bclink_init(void)
786 return -ENOMEM; 786 return -ENOMEM;
787 } 787 }
788 788
789 memset(bcbearer, 0, sizeof(struct bcbearer));
790 INIT_LIST_HEAD(&bcbearer->bearer.cong_links); 789 INIT_LIST_HEAD(&bcbearer->bearer.cong_links);
791 bcbearer->bearer.media = &bcbearer->media; 790 bcbearer->bearer.media = &bcbearer->media;
792 bcbearer->media.send_msg = tipc_bcbearer_send; 791 bcbearer->media.send_msg = tipc_bcbearer_send;
793 sprintf(bcbearer->media.name, "tipc-multicast"); 792 sprintf(bcbearer->media.name, "tipc-multicast");
794 793
795 bcl = &bclink->link; 794 bcl = &bclink->link;
796 memset(bclink, 0, sizeof(struct bclink));
797 INIT_LIST_HEAD(&bcl->waiting_ports); 795 INIT_LIST_HEAD(&bcl->waiting_ports);
798 bcl->next_out_no = 1; 796 bcl->next_out_no = 1;
799 spin_lock_init(&bclink->node.lock); 797 spin_lock_init(&bclink->node.lock);
diff --git a/net/tipc/node.c b/net/tipc/node.c
index 106cd0dfac78..4111a31def79 100644
--- a/net/tipc/node.c
+++ b/net/tipc/node.c
@@ -60,7 +60,7 @@ struct node *tipc_node_create(u32 addr)
60 struct node *n_ptr; 60 struct node *n_ptr;
61 struct node **curr_node; 61 struct node **curr_node;
62 62
63 n_ptr = kmalloc(sizeof(*n_ptr),GFP_ATOMIC); 63 n_ptr = kzalloc(sizeof(*n_ptr),GFP_ATOMIC);
64 if (!n_ptr) { 64 if (!n_ptr) {
65 warn("Node creation failed, no memory\n"); 65 warn("Node creation failed, no memory\n");
66 return NULL; 66 return NULL;
@@ -75,7 +75,6 @@ struct node *tipc_node_create(u32 addr)
75 return NULL; 75 return NULL;
76 } 76 }
77 77
78 memset(n_ptr, 0, sizeof(*n_ptr));
79 n_ptr->addr = addr; 78 n_ptr->addr = addr;
80 spin_lock_init(&n_ptr->lock); 79 spin_lock_init(&n_ptr->lock);
81 INIT_LIST_HEAD(&n_ptr->nsub); 80 INIT_LIST_HEAD(&n_ptr->nsub);
diff --git a/net/tipc/subscr.c b/net/tipc/subscr.c
index 7a918f12a5df..ddade7388aa0 100644
--- a/net/tipc/subscr.c
+++ b/net/tipc/subscr.c
@@ -350,7 +350,7 @@ static void subscr_subscribe(struct tipc_subscr *s,
350 350
351 /* Allocate subscription object */ 351 /* Allocate subscription object */
352 352
353 sub = kmalloc(sizeof(*sub), GFP_ATOMIC); 353 sub = kzalloc(sizeof(*sub), GFP_ATOMIC);
354 if (!sub) { 354 if (!sub) {
355 warn("Subscription rejected, no memory\n"); 355 warn("Subscription rejected, no memory\n");
356 subscr_terminate(subscriber); 356 subscr_terminate(subscriber);
@@ -359,7 +359,6 @@ static void subscr_subscribe(struct tipc_subscr *s,
359 359
360 /* Initialize subscription object */ 360 /* Initialize subscription object */
361 361
362 memset(sub, 0, sizeof(*sub));
363 sub->seq.type = htohl(s->seq.type, subscriber->swap); 362 sub->seq.type = htohl(s->seq.type, subscriber->swap);
364 sub->seq.lower = htohl(s->seq.lower, subscriber->swap); 363 sub->seq.lower = htohl(s->seq.lower, subscriber->swap);
365 sub->seq.upper = htohl(s->seq.upper, subscriber->swap); 364 sub->seq.upper = htohl(s->seq.upper, subscriber->swap);