aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/name_table.c
diff options
context:
space:
mode:
authorPanagiotis Issaris <takis@issaris.org>2006-07-21 17:51:30 -0400
committerDavid S. Miller <davem@davemloft.net>2006-07-21 17:51:30 -0400
commit0da974f4f303a6842516b764507e3c0a03f41e5a (patch)
tree8872aec792f02040269c6769dd1009b20f71d186 /net/tipc/name_table.c
parenta0ee7c70b22f78593957f99faa06acb4747b8bc0 (diff)
[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/name_table.c')
-rw-r--r--net/tipc/name_table.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c
index a6926ff07bcc..049242ea5c38 100644
--- a/net/tipc/name_table.c
+++ b/net/tipc/name_table.c
@@ -117,14 +117,12 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
117 u32 scope, u32 node, u32 port_ref, 117 u32 scope, u32 node, u32 port_ref,
118 u32 key) 118 u32 key)
119{ 119{
120 struct publication *publ = 120 struct publication *publ = kzalloc(sizeof(*publ), GFP_ATOMIC);
121 (struct publication *)kmalloc(sizeof(*publ), GFP_ATOMIC);
122 if (publ == NULL) { 121 if (publ == NULL) {
123 warn("Publication creation failure, no memory\n"); 122 warn("Publication creation failure, no memory\n");
124 return NULL; 123 return NULL;
125 } 124 }
126 125
127 memset(publ, 0, sizeof(*publ));
128 publ->type = type; 126 publ->type = type;
129 publ->lower = lower; 127 publ->lower = lower;
130 publ->upper = upper; 128 publ->upper = upper;
@@ -144,11 +142,7 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper,
144 142
145static struct sub_seq *tipc_subseq_alloc(u32 cnt) 143static struct sub_seq *tipc_subseq_alloc(u32 cnt)
146{ 144{
147 u32 sz = cnt * sizeof(struct sub_seq); 145 struct sub_seq *sseq = kcalloc(cnt, sizeof(struct sub_seq), GFP_ATOMIC);
148 struct sub_seq *sseq = (struct sub_seq *)kmalloc(sz, GFP_ATOMIC);
149
150 if (sseq)
151 memset(sseq, 0, sz);
152 return sseq; 146 return sseq;
153} 147}
154 148
@@ -160,8 +154,7 @@ static struct sub_seq *tipc_subseq_alloc(u32 cnt)
160 154
161static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head) 155static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head)
162{ 156{
163 struct name_seq *nseq = 157 struct name_seq *nseq = kzalloc(sizeof(*nseq), GFP_ATOMIC);
164 (struct name_seq *)kmalloc(sizeof(*nseq), GFP_ATOMIC);
165 struct sub_seq *sseq = tipc_subseq_alloc(1); 158 struct sub_seq *sseq = tipc_subseq_alloc(1);
166 159
167 if (!nseq || !sseq) { 160 if (!nseq || !sseq) {
@@ -171,7 +164,6 @@ static struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_hea
171 return NULL; 164 return NULL;
172 } 165 }
173 166
174 memset(nseq, 0, sizeof(*nseq));
175 spin_lock_init(&nseq->lock); 167 spin_lock_init(&nseq->lock);
176 nseq->type = type; 168 nseq->type = type;
177 nseq->sseqs = sseq; 169 nseq->sseqs = sseq;
@@ -1060,7 +1052,7 @@ int tipc_nametbl_init(void)
1060{ 1052{
1061 int array_size = sizeof(struct hlist_head) * tipc_nametbl_size; 1053 int array_size = sizeof(struct hlist_head) * tipc_nametbl_size;
1062 1054
1063 table.types = (struct hlist_head *)kmalloc(array_size, GFP_ATOMIC); 1055 table.types = kmalloc(array_size, GFP_ATOMIC);
1064 if (!table.types) 1056 if (!table.types)
1065 return -ENOMEM; 1057 return -ENOMEM;
1066 1058