diff options
author | Sam Ravnborg <sam@ravnborg.org> | 2006-03-21 01:36:47 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 01:36:47 -0500 |
commit | 1fc54d8f49c1270c584803437fb7c0ac543588c1 (patch) | |
tree | 13bccf49154e57986a7e218e38d243912aaea6d1 /net/tipc/name_table.c | |
parent | edb2c34fb2683ff21c8a6bcc3e41c07a53601761 (diff) |
[TIPC]: Fix simple sparse warnings
Tried to run the new tipc stack through sparse.
Following patch fixes all cases where 0 was used
as replacement of NULL.
Use NULL to document this is a pointer and to silence sparse.
This brough sparse warning count down with 127 to 24 warnings.
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Per Liden <per.liden@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/name_table.c')
-rw-r--r-- | net/tipc/name_table.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index 3f4b23bd08f7..a865954bd95c 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c | |||
@@ -121,7 +121,7 @@ static struct publication *publ_create(u32 type, u32 lower, u32 upper, | |||
121 | (struct publication *)kmalloc(sizeof(*publ), GFP_ATOMIC); | 121 | (struct publication *)kmalloc(sizeof(*publ), GFP_ATOMIC); |
122 | if (publ == NULL) { | 122 | if (publ == NULL) { |
123 | warn("Memory squeeze; failed to create publication\n"); | 123 | warn("Memory squeeze; failed to create publication\n"); |
124 | return 0; | 124 | return NULL; |
125 | } | 125 | } |
126 | 126 | ||
127 | memset(publ, 0, sizeof(*publ)); | 127 | memset(publ, 0, sizeof(*publ)); |
@@ -168,7 +168,7 @@ struct name_seq *tipc_nameseq_create(u32 type, struct hlist_head *seq_head) | |||
168 | warn("Memory squeeze; failed to create name sequence\n"); | 168 | warn("Memory squeeze; failed to create name sequence\n"); |
169 | kfree(nseq); | 169 | kfree(nseq); |
170 | kfree(sseq); | 170 | kfree(sseq); |
171 | return 0; | 171 | return NULL; |
172 | } | 172 | } |
173 | 173 | ||
174 | memset(nseq, 0, sizeof(*nseq)); | 174 | memset(nseq, 0, sizeof(*nseq)); |
@@ -207,7 +207,7 @@ static inline struct sub_seq *nameseq_find_subseq(struct name_seq *nseq, | |||
207 | else | 207 | else |
208 | return &sseqs[mid]; | 208 | return &sseqs[mid]; |
209 | } | 209 | } |
210 | return 0; | 210 | return NULL; |
211 | } | 211 | } |
212 | 212 | ||
213 | /** | 213 | /** |
@@ -263,7 +263,7 @@ struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, | |||
263 | 263 | ||
264 | if ((sseq->lower != lower) || (sseq->upper != upper)) { | 264 | if ((sseq->lower != lower) || (sseq->upper != upper)) { |
265 | warn("Overlapping publ <%u,%u,%u>\n", type, lower, upper); | 265 | warn("Overlapping publ <%u,%u,%u>\n", type, lower, upper); |
266 | return 0; | 266 | return NULL; |
267 | } | 267 | } |
268 | } else { | 268 | } else { |
269 | u32 inspos; | 269 | u32 inspos; |
@@ -278,7 +278,7 @@ struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, | |||
278 | if ((inspos < nseq->first_free) && | 278 | if ((inspos < nseq->first_free) && |
279 | (upper >= nseq->sseqs[inspos].lower)) { | 279 | (upper >= nseq->sseqs[inspos].lower)) { |
280 | warn("Overlapping publ <%u,%u,%u>\n", type, lower, upper); | 280 | warn("Overlapping publ <%u,%u,%u>\n", type, lower, upper); |
281 | return 0; | 281 | return NULL; |
282 | } | 282 | } |
283 | 283 | ||
284 | /* Ensure there is space for new sub-sequence */ | 284 | /* Ensure there is space for new sub-sequence */ |
@@ -294,7 +294,7 @@ struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, | |||
294 | nseq->alloc *= 2; | 294 | nseq->alloc *= 2; |
295 | } else { | 295 | } else { |
296 | warn("Memory squeeze; failed to create sub-sequence\n"); | 296 | warn("Memory squeeze; failed to create sub-sequence\n"); |
297 | return 0; | 297 | return NULL; |
298 | } | 298 | } |
299 | } | 299 | } |
300 | dbg("Have %u sseqs for type %u\n", nseq->alloc, type); | 300 | dbg("Have %u sseqs for type %u\n", nseq->alloc, type); |
@@ -319,7 +319,7 @@ struct publication *tipc_nameseq_insert_publ(struct name_seq *nseq, | |||
319 | 319 | ||
320 | publ = publ_create(type, lower, upper, scope, node, port, key); | 320 | publ = publ_create(type, lower, upper, scope, node, port, key); |
321 | if (!publ) | 321 | if (!publ) |
322 | return 0; | 322 | return NULL; |
323 | dbg("inserting publ %x, node=%x publ->node=%x, subscr->node=%x\n", | 323 | dbg("inserting publ %x, node=%x publ->node=%x, subscr->node=%x\n", |
324 | publ, node, publ->node, publ->subscr.node); | 324 | publ, node, publ->node, publ->subscr.node); |
325 | 325 | ||
@@ -394,7 +394,7 @@ struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst, | |||
394 | i, &nseq->sseqs[i], nseq->sseqs[i].lower, | 394 | i, &nseq->sseqs[i], nseq->sseqs[i].lower, |
395 | nseq->sseqs[i].upper); | 395 | nseq->sseqs[i].upper); |
396 | } | 396 | } |
397 | return 0; | 397 | return NULL; |
398 | } | 398 | } |
399 | dbg("nameseq_remove: seq: %x, sseq %x, <%u,%u> key %u\n", | 399 | dbg("nameseq_remove: seq: %x, sseq %x, <%u,%u> key %u\n", |
400 | nseq, sseq, nseq->type, inst, key); | 400 | nseq, sseq, nseq->type, inst, key); |
@@ -413,7 +413,7 @@ struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst, | |||
413 | prev->zone_list_next = publ->zone_list_next; | 413 | prev->zone_list_next = publ->zone_list_next; |
414 | sseq->zone_list = publ->zone_list_next; | 414 | sseq->zone_list = publ->zone_list_next; |
415 | } else { | 415 | } else { |
416 | sseq->zone_list = 0; | 416 | sseq->zone_list = NULL; |
417 | } | 417 | } |
418 | 418 | ||
419 | if (in_own_cluster(node)) { | 419 | if (in_own_cluster(node)) { |
@@ -431,7 +431,7 @@ struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst, | |||
431 | prev->cluster_list_next = publ->cluster_list_next; | 431 | prev->cluster_list_next = publ->cluster_list_next; |
432 | sseq->cluster_list = publ->cluster_list_next; | 432 | sseq->cluster_list = publ->cluster_list_next; |
433 | } else { | 433 | } else { |
434 | sseq->cluster_list = 0; | 434 | sseq->cluster_list = NULL; |
435 | } | 435 | } |
436 | } | 436 | } |
437 | 437 | ||
@@ -450,7 +450,7 @@ struct publication *tipc_nameseq_remove_publ(struct name_seq *nseq, u32 inst, | |||
450 | prev->node_list_next = publ->node_list_next; | 450 | prev->node_list_next = publ->node_list_next; |
451 | sseq->node_list = publ->node_list_next; | 451 | sseq->node_list = publ->node_list_next; |
452 | } else { | 452 | } else { |
453 | sseq->node_list = 0; | 453 | sseq->node_list = NULL; |
454 | } | 454 | } |
455 | } | 455 | } |
456 | assert(!publ->node || (publ->node == node)); | 456 | assert(!publ->node || (publ->node == node)); |
@@ -535,7 +535,7 @@ static struct name_seq *nametbl_find_seq(u32 type) | |||
535 | } | 535 | } |
536 | } | 536 | } |
537 | 537 | ||
538 | return 0; | 538 | return NULL; |
539 | }; | 539 | }; |
540 | 540 | ||
541 | struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper, | 541 | struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper, |
@@ -547,7 +547,7 @@ struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper, | |||
547 | if (lower > upper) { | 547 | if (lower > upper) { |
548 | warn("Failed to publish illegal <%u,%u,%u>\n", | 548 | warn("Failed to publish illegal <%u,%u,%u>\n", |
549 | type, lower, upper); | 549 | type, lower, upper); |
550 | return 0; | 550 | return NULL; |
551 | } | 551 | } |
552 | 552 | ||
553 | dbg("Publishing <%u,%u,%u> from %x\n", type, lower, upper, node); | 553 | dbg("Publishing <%u,%u,%u> from %x\n", type, lower, upper, node); |
@@ -556,7 +556,7 @@ struct publication *tipc_nametbl_insert_publ(u32 type, u32 lower, u32 upper, | |||
556 | dbg("tipc_nametbl_insert_publ: created %x\n", seq); | 556 | dbg("tipc_nametbl_insert_publ: created %x\n", seq); |
557 | } | 557 | } |
558 | if (!seq) | 558 | if (!seq) |
559 | return 0; | 559 | return NULL; |
560 | 560 | ||
561 | assert(seq->type == type); | 561 | assert(seq->type == type); |
562 | return tipc_nameseq_insert_publ(seq, type, lower, upper, | 562 | return tipc_nameseq_insert_publ(seq, type, lower, upper, |
@@ -570,7 +570,7 @@ struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, | |||
570 | struct name_seq *seq = nametbl_find_seq(type); | 570 | struct name_seq *seq = nametbl_find_seq(type); |
571 | 571 | ||
572 | if (!seq) | 572 | if (!seq) |
573 | return 0; | 573 | return NULL; |
574 | 574 | ||
575 | dbg("Withdrawing <%u,%u> from %x\n", type, lower, node); | 575 | dbg("Withdrawing <%u,%u> from %x\n", type, lower, node); |
576 | publ = tipc_nameseq_remove_publ(seq, lower, node, ref, key); | 576 | publ = tipc_nameseq_remove_publ(seq, lower, node, ref, key); |
@@ -594,7 +594,7 @@ struct publication *tipc_nametbl_remove_publ(u32 type, u32 lower, | |||
594 | u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode) | 594 | u32 tipc_nametbl_translate(u32 type, u32 instance, u32 *destnode) |
595 | { | 595 | { |
596 | struct sub_seq *sseq; | 596 | struct sub_seq *sseq; |
597 | struct publication *publ = 0; | 597 | struct publication *publ = NULL; |
598 | struct name_seq *seq; | 598 | struct name_seq *seq; |
599 | u32 ref; | 599 | u32 ref; |
600 | 600 | ||
@@ -740,12 +740,12 @@ struct publication *tipc_nametbl_publish(u32 type, u32 lower, u32 upper, | |||
740 | if (table.local_publ_count >= tipc_max_publications) { | 740 | if (table.local_publ_count >= tipc_max_publications) { |
741 | warn("Failed publish: max %u local publication\n", | 741 | warn("Failed publish: max %u local publication\n", |
742 | tipc_max_publications); | 742 | tipc_max_publications); |
743 | return 0; | 743 | return NULL; |
744 | } | 744 | } |
745 | if ((type < TIPC_RESERVED_TYPES) && !atomic_read(&rsv_publ_ok)) { | 745 | if ((type < TIPC_RESERVED_TYPES) && !atomic_read(&rsv_publ_ok)) { |
746 | warn("Failed to publish reserved name <%u,%u,%u>\n", | 746 | warn("Failed to publish reserved name <%u,%u,%u>\n", |
747 | type, lower, upper); | 747 | type, lower, upper); |
748 | return 0; | 748 | return NULL; |
749 | } | 749 | } |
750 | 750 | ||
751 | write_lock_bh(&tipc_nametbl_lock); | 751 | write_lock_bh(&tipc_nametbl_lock); |