aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/originator.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2012-05-05 07:27:28 -0400
committerAntonio Quartulli <ordex@autistici.org>2012-06-18 12:01:03 -0400
commit5346c35ebfbdb1727e60079456dd8071cb888059 (patch)
tree90bba36cd5e27b1a248cf78d4a4859b6d7275092 /net/batman-adv/originator.c
parente0f5211f9bbfaa66d27cda6b0dc86466c7dcb206 (diff)
batman-adv: Return error codes instead of -1 on failures
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Diffstat (limited to 'net/batman-adv/originator.c')
-rw-r--r--net/batman-adv/originator.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/net/batman-adv/originator.c b/net/batman-adv/originator.c
index 41147942ba53..cf83c5422e9a 100644
--- a/net/batman-adv/originator.c
+++ b/net/batman-adv/originator.c
@@ -50,7 +50,7 @@ static int compare_orig(const struct hlist_node *node, const void *data2)
50int originator_init(struct bat_priv *bat_priv) 50int originator_init(struct bat_priv *bat_priv)
51{ 51{
52 if (bat_priv->orig_hash) 52 if (bat_priv->orig_hash)
53 return 1; 53 return 0;
54 54
55 bat_priv->orig_hash = hash_new(1024); 55 bat_priv->orig_hash = hash_new(1024);
56 56
@@ -58,10 +58,10 @@ int originator_init(struct bat_priv *bat_priv)
58 goto err; 58 goto err;
59 59
60 start_purge_timer(bat_priv); 60 start_purge_timer(bat_priv);
61 return 1; 61 return 0;
62 62
63err: 63err:
64 return 0; 64 return -ENOMEM;
65} 65}
66 66
67void neigh_node_free_ref(struct neigh_node *neigh_node) 67void neigh_node_free_ref(struct neigh_node *neigh_node)
@@ -488,7 +488,7 @@ static int orig_node_add_if(struct orig_node *orig_node, int max_if_num)
488 data_ptr = kmalloc(max_if_num * sizeof(unsigned long) * NUM_WORDS, 488 data_ptr = kmalloc(max_if_num * sizeof(unsigned long) * NUM_WORDS,
489 GFP_ATOMIC); 489 GFP_ATOMIC);
490 if (!data_ptr) 490 if (!data_ptr)
491 return -1; 491 return -ENOMEM;
492 492
493 memcpy(data_ptr, orig_node->bcast_own, 493 memcpy(data_ptr, orig_node->bcast_own,
494 (max_if_num - 1) * sizeof(unsigned long) * NUM_WORDS); 494 (max_if_num - 1) * sizeof(unsigned long) * NUM_WORDS);
@@ -497,7 +497,7 @@ static int orig_node_add_if(struct orig_node *orig_node, int max_if_num)
497 497
498 data_ptr = kmalloc(max_if_num * sizeof(uint8_t), GFP_ATOMIC); 498 data_ptr = kmalloc(max_if_num * sizeof(uint8_t), GFP_ATOMIC);
499 if (!data_ptr) 499 if (!data_ptr)
500 return -1; 500 return -ENOMEM;
501 501
502 memcpy(data_ptr, orig_node->bcast_own_sum, 502 memcpy(data_ptr, orig_node->bcast_own_sum,
503 (max_if_num - 1) * sizeof(uint8_t)); 503 (max_if_num - 1) * sizeof(uint8_t));
@@ -528,7 +528,7 @@ int orig_hash_add_if(struct hard_iface *hard_iface, int max_if_num)
528 ret = orig_node_add_if(orig_node, max_if_num); 528 ret = orig_node_add_if(orig_node, max_if_num);
529 spin_unlock_bh(&orig_node->ogm_cnt_lock); 529 spin_unlock_bh(&orig_node->ogm_cnt_lock);
530 530
531 if (ret == -1) 531 if (ret == -ENOMEM)
532 goto err; 532 goto err;
533 } 533 }
534 rcu_read_unlock(); 534 rcu_read_unlock();
@@ -554,7 +554,7 @@ static int orig_node_del_if(struct orig_node *orig_node,
554 chunk_size = sizeof(unsigned long) * NUM_WORDS; 554 chunk_size = sizeof(unsigned long) * NUM_WORDS;
555 data_ptr = kmalloc(max_if_num * chunk_size, GFP_ATOMIC); 555 data_ptr = kmalloc(max_if_num * chunk_size, GFP_ATOMIC);
556 if (!data_ptr) 556 if (!data_ptr)
557 return -1; 557 return -ENOMEM;
558 558
559 /* copy first part */ 559 /* copy first part */
560 memcpy(data_ptr, orig_node->bcast_own, del_if_num * chunk_size); 560 memcpy(data_ptr, orig_node->bcast_own, del_if_num * chunk_size);
@@ -573,7 +573,7 @@ free_bcast_own:
573 573
574 data_ptr = kmalloc(max_if_num * sizeof(uint8_t), GFP_ATOMIC); 574 data_ptr = kmalloc(max_if_num * sizeof(uint8_t), GFP_ATOMIC);
575 if (!data_ptr) 575 if (!data_ptr)
576 return -1; 576 return -ENOMEM;
577 577
578 memcpy(data_ptr, orig_node->bcast_own_sum, 578 memcpy(data_ptr, orig_node->bcast_own_sum,
579 del_if_num * sizeof(uint8_t)); 579 del_if_num * sizeof(uint8_t));
@@ -612,7 +612,7 @@ int orig_hash_del_if(struct hard_iface *hard_iface, int max_if_num)
612 hard_iface->if_num); 612 hard_iface->if_num);
613 spin_unlock_bh(&orig_node->ogm_cnt_lock); 613 spin_unlock_bh(&orig_node->ogm_cnt_lock);
614 614
615 if (ret == -1) 615 if (ret == -ENOMEM)
616 goto err; 616 goto err;
617 } 617 }
618 rcu_read_unlock(); 618 rcu_read_unlock();