diff options
author | Sven Eckelmann <sven@narfation.org> | 2012-05-05 07:27:28 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-06-18 12:01:03 -0400 |
commit | 5346c35ebfbdb1727e60079456dd8071cb888059 (patch) | |
tree | 90bba36cd5e27b1a248cf78d4a4859b6d7275092 /net/batman-adv | |
parent | e0f5211f9bbfaa66d27cda6b0dc86466c7dcb206 (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')
-rw-r--r-- | net/batman-adv/bat_debugfs.c | 11 | ||||
-rw-r--r-- | net/batman-adv/bat_iv_ogm.c | 2 | ||||
-rw-r--r-- | net/batman-adv/bat_sysfs.c | 2 | ||||
-rw-r--r-- | net/batman-adv/bridge_loop_avoidance.c | 6 | ||||
-rw-r--r-- | net/batman-adv/hard-interface.c | 4 | ||||
-rw-r--r-- | net/batman-adv/icmp_socket.c | 4 | ||||
-rw-r--r-- | net/batman-adv/main.c | 27 | ||||
-rw-r--r-- | net/batman-adv/originator.c | 18 | ||||
-rw-r--r-- | net/batman-adv/translation-table.c | 24 | ||||
-rw-r--r-- | net/batman-adv/vis.c | 8 |
10 files changed, 58 insertions, 48 deletions
diff --git a/net/batman-adv/bat_debugfs.c b/net/batman-adv/bat_debugfs.c index 3b588f86d770..db8273c26989 100644 --- a/net/batman-adv/bat_debugfs.c +++ b/net/batman-adv/bat_debugfs.c | |||
@@ -195,13 +195,13 @@ static int debug_log_setup(struct bat_priv *bat_priv) | |||
195 | 195 | ||
196 | d = debugfs_create_file("log", S_IFREG | S_IRUSR, | 196 | d = debugfs_create_file("log", S_IFREG | S_IRUSR, |
197 | bat_priv->debug_dir, bat_priv, &log_fops); | 197 | bat_priv->debug_dir, bat_priv, &log_fops); |
198 | if (d) | 198 | if (!d) |
199 | goto err; | 199 | goto err; |
200 | 200 | ||
201 | return 0; | 201 | return 0; |
202 | 202 | ||
203 | err: | 203 | err: |
204 | return 1; | 204 | return -ENOMEM; |
205 | } | 205 | } |
206 | 206 | ||
207 | static void debug_log_cleanup(struct bat_priv *bat_priv) | 207 | static void debug_log_cleanup(struct bat_priv *bat_priv) |
@@ -348,8 +348,11 @@ int debugfs_add_meshif(struct net_device *dev) | |||
348 | if (!bat_priv->debug_dir) | 348 | if (!bat_priv->debug_dir) |
349 | goto out; | 349 | goto out; |
350 | 350 | ||
351 | bat_socket_setup(bat_priv); | 351 | if (bat_socket_setup(bat_priv) < 0) |
352 | debug_log_setup(bat_priv); | 352 | goto rem_attr; |
353 | |||
354 | if (debug_log_setup(bat_priv) < 0) | ||
355 | goto rem_attr; | ||
353 | 356 | ||
354 | for (bat_debug = mesh_debuginfos; *bat_debug; ++bat_debug) { | 357 | for (bat_debug = mesh_debuginfos; *bat_debug; ++bat_debug) { |
355 | file = debugfs_create_file(((*bat_debug)->attr).name, | 358 | file = debugfs_create_file(((*bat_debug)->attr).name, |
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 56b6d78bfbfd..896287e62df9 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
@@ -60,7 +60,7 @@ static int bat_iv_ogm_iface_enable(struct hard_iface *hard_iface) | |||
60 | { | 60 | { |
61 | struct batman_ogm_packet *batman_ogm_packet; | 61 | struct batman_ogm_packet *batman_ogm_packet; |
62 | uint32_t random_seqno; | 62 | uint32_t random_seqno; |
63 | int res = -1; | 63 | int res = -ENOMEM; |
64 | 64 | ||
65 | /* randomize initial seqno to avoid collision */ | 65 | /* randomize initial seqno to avoid collision */ |
66 | get_random_bytes(&random_seqno, sizeof(random_seqno)); | 66 | get_random_bytes(&random_seqno, sizeof(random_seqno)); |
diff --git a/net/batman-adv/bat_sysfs.c b/net/batman-adv/bat_sysfs.c index 5bc7b66d32dc..62f4f6cb888a 100644 --- a/net/batman-adv/bat_sysfs.c +++ b/net/batman-adv/bat_sysfs.c | |||
@@ -680,7 +680,7 @@ void sysfs_del_hardif(struct kobject **hardif_obj) | |||
680 | int throw_uevent(struct bat_priv *bat_priv, enum uev_type type, | 680 | int throw_uevent(struct bat_priv *bat_priv, enum uev_type type, |
681 | enum uev_action action, const char *data) | 681 | enum uev_action action, const char *data) |
682 | { | 682 | { |
683 | int ret = -1; | 683 | int ret = -ENOMEM; |
684 | struct hard_iface *primary_if = NULL; | 684 | struct hard_iface *primary_if = NULL; |
685 | struct kobject *bat_kobj; | 685 | struct kobject *bat_kobj; |
686 | char *uevent_env[4] = { NULL, NULL, NULL, NULL }; | 686 | char *uevent_env[4] = { NULL, NULL, NULL, NULL }; |
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 0355c48db282..314e37b272a7 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
@@ -1164,13 +1164,13 @@ int bla_init(struct bat_priv *bat_priv) | |||
1164 | bat_priv->bcast_duplist_curr = 0; | 1164 | bat_priv->bcast_duplist_curr = 0; |
1165 | 1165 | ||
1166 | if (bat_priv->claim_hash) | 1166 | if (bat_priv->claim_hash) |
1167 | return 1; | 1167 | return 0; |
1168 | 1168 | ||
1169 | bat_priv->claim_hash = hash_new(128); | 1169 | bat_priv->claim_hash = hash_new(128); |
1170 | bat_priv->backbone_hash = hash_new(32); | 1170 | bat_priv->backbone_hash = hash_new(32); |
1171 | 1171 | ||
1172 | if (!bat_priv->claim_hash || !bat_priv->backbone_hash) | 1172 | if (!bat_priv->claim_hash || !bat_priv->backbone_hash) |
1173 | return -1; | 1173 | return -ENOMEM; |
1174 | 1174 | ||
1175 | batadv_hash_set_lock_class(bat_priv->claim_hash, | 1175 | batadv_hash_set_lock_class(bat_priv->claim_hash, |
1176 | &claim_hash_lock_class_key); | 1176 | &claim_hash_lock_class_key); |
@@ -1180,7 +1180,7 @@ int bla_init(struct bat_priv *bat_priv) | |||
1180 | bat_dbg(DBG_BLA, bat_priv, "bla hashes initialized\n"); | 1180 | bat_dbg(DBG_BLA, bat_priv, "bla hashes initialized\n"); |
1181 | 1181 | ||
1182 | bla_start_timer(bat_priv); | 1182 | bla_start_timer(bat_priv); |
1183 | return 1; | 1183 | return 0; |
1184 | } | 1184 | } |
1185 | 1185 | ||
1186 | /** | 1186 | /** |
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index dc334fa89847..ce78c6d645c6 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c | |||
@@ -306,10 +306,8 @@ int hardif_enable_interface(struct hard_iface *hard_iface, | |||
306 | bat_priv = netdev_priv(hard_iface->soft_iface); | 306 | bat_priv = netdev_priv(hard_iface->soft_iface); |
307 | 307 | ||
308 | ret = bat_priv->bat_algo_ops->bat_iface_enable(hard_iface); | 308 | ret = bat_priv->bat_algo_ops->bat_iface_enable(hard_iface); |
309 | if (ret < 0) { | 309 | if (ret < 0) |
310 | ret = -ENOMEM; | ||
311 | goto err_dev; | 310 | goto err_dev; |
312 | } | ||
313 | 311 | ||
314 | hard_iface->if_num = bat_priv->num_ifaces; | 312 | hard_iface->if_num = bat_priv->num_ifaces; |
315 | bat_priv->num_ifaces++; | 313 | bat_priv->num_ifaces++; |
diff --git a/net/batman-adv/icmp_socket.c b/net/batman-adv/icmp_socket.c index 2e98a57f3407..d27db8192e93 100644 --- a/net/batman-adv/icmp_socket.c +++ b/net/batman-adv/icmp_socket.c | |||
@@ -285,13 +285,13 @@ int bat_socket_setup(struct bat_priv *bat_priv) | |||
285 | 285 | ||
286 | d = debugfs_create_file(ICMP_SOCKET, S_IFREG | S_IWUSR | S_IRUSR, | 286 | d = debugfs_create_file(ICMP_SOCKET, S_IFREG | S_IWUSR | S_IRUSR, |
287 | bat_priv->debug_dir, bat_priv, &fops); | 287 | bat_priv->debug_dir, bat_priv, &fops); |
288 | if (d) | 288 | if (!d) |
289 | goto err; | 289 | goto err; |
290 | 290 | ||
291 | return 0; | 291 | return 0; |
292 | 292 | ||
293 | err: | 293 | err: |
294 | return 1; | 294 | return -ENOMEM; |
295 | } | 295 | } |
296 | 296 | ||
297 | static void bat_socket_add_packet(struct socket_client *socket_client, | 297 | static void bat_socket_add_packet(struct socket_client *socket_client, |
diff --git a/net/batman-adv/main.c b/net/batman-adv/main.c index 8610b5caa178..46ba302d2d01 100644 --- a/net/batman-adv/main.c +++ b/net/batman-adv/main.c | |||
@@ -92,6 +92,7 @@ static void __exit batman_exit(void) | |||
92 | int mesh_init(struct net_device *soft_iface) | 92 | int mesh_init(struct net_device *soft_iface) |
93 | { | 93 | { |
94 | struct bat_priv *bat_priv = netdev_priv(soft_iface); | 94 | struct bat_priv *bat_priv = netdev_priv(soft_iface); |
95 | int ret; | ||
95 | 96 | ||
96 | spin_lock_init(&bat_priv->forw_bat_list_lock); | 97 | spin_lock_init(&bat_priv->forw_bat_list_lock); |
97 | spin_lock_init(&bat_priv->forw_bcast_list_lock); | 98 | spin_lock_init(&bat_priv->forw_bcast_list_lock); |
@@ -110,30 +111,32 @@ int mesh_init(struct net_device *soft_iface) | |||
110 | INIT_LIST_HEAD(&bat_priv->tt_req_list); | 111 | INIT_LIST_HEAD(&bat_priv->tt_req_list); |
111 | INIT_LIST_HEAD(&bat_priv->tt_roam_list); | 112 | INIT_LIST_HEAD(&bat_priv->tt_roam_list); |
112 | 113 | ||
113 | if (originator_init(bat_priv) < 1) | 114 | ret = originator_init(bat_priv); |
115 | if (ret < 0) | ||
114 | goto err; | 116 | goto err; |
115 | 117 | ||
116 | if (tt_init(bat_priv) < 1) | 118 | ret = tt_init(bat_priv); |
119 | if (ret < 0) | ||
117 | goto err; | 120 | goto err; |
118 | 121 | ||
119 | tt_local_add(soft_iface, soft_iface->dev_addr, NULL_IFINDEX); | 122 | tt_local_add(soft_iface, soft_iface->dev_addr, NULL_IFINDEX); |
120 | 123 | ||
121 | if (vis_init(bat_priv) < 1) | 124 | ret = vis_init(bat_priv); |
125 | if (ret < 0) | ||
122 | goto err; | 126 | goto err; |
123 | 127 | ||
124 | if (bla_init(bat_priv) < 1) | 128 | ret = bla_init(bat_priv); |
129 | if (ret < 0) | ||
125 | goto err; | 130 | goto err; |
126 | 131 | ||
127 | atomic_set(&bat_priv->gw_reselect, 0); | 132 | atomic_set(&bat_priv->gw_reselect, 0); |
128 | atomic_set(&bat_priv->mesh_state, MESH_ACTIVE); | 133 | atomic_set(&bat_priv->mesh_state, MESH_ACTIVE); |
129 | goto end; | 134 | |
135 | return 0; | ||
130 | 136 | ||
131 | err: | 137 | err: |
132 | mesh_free(soft_iface); | 138 | mesh_free(soft_iface); |
133 | return -1; | 139 | return ret; |
134 | |||
135 | end: | ||
136 | return 0; | ||
137 | } | 140 | } |
138 | 141 | ||
139 | void mesh_free(struct net_device *soft_iface) | 142 | void mesh_free(struct net_device *soft_iface) |
@@ -319,12 +322,13 @@ static struct bat_algo_ops *bat_algo_get(char *name) | |||
319 | int bat_algo_register(struct bat_algo_ops *bat_algo_ops) | 322 | int bat_algo_register(struct bat_algo_ops *bat_algo_ops) |
320 | { | 323 | { |
321 | struct bat_algo_ops *bat_algo_ops_tmp; | 324 | struct bat_algo_ops *bat_algo_ops_tmp; |
322 | int ret = -1; | 325 | int ret; |
323 | 326 | ||
324 | bat_algo_ops_tmp = bat_algo_get(bat_algo_ops->name); | 327 | bat_algo_ops_tmp = bat_algo_get(bat_algo_ops->name); |
325 | if (bat_algo_ops_tmp) { | 328 | if (bat_algo_ops_tmp) { |
326 | pr_info("Trying to register already registered routing algorithm: %s\n", | 329 | pr_info("Trying to register already registered routing algorithm: %s\n", |
327 | bat_algo_ops->name); | 330 | bat_algo_ops->name); |
331 | ret = -EEXIST; | ||
328 | goto out; | 332 | goto out; |
329 | } | 333 | } |
330 | 334 | ||
@@ -337,6 +341,7 @@ int bat_algo_register(struct bat_algo_ops *bat_algo_ops) | |||
337 | !bat_algo_ops->bat_ogm_emit) { | 341 | !bat_algo_ops->bat_ogm_emit) { |
338 | pr_info("Routing algo '%s' does not implement required ops\n", | 342 | pr_info("Routing algo '%s' does not implement required ops\n", |
339 | bat_algo_ops->name); | 343 | bat_algo_ops->name); |
344 | ret = -EINVAL; | ||
340 | goto out; | 345 | goto out; |
341 | } | 346 | } |
342 | 347 | ||
@@ -351,7 +356,7 @@ out: | |||
351 | int bat_algo_select(struct bat_priv *bat_priv, char *name) | 356 | int bat_algo_select(struct bat_priv *bat_priv, char *name) |
352 | { | 357 | { |
353 | struct bat_algo_ops *bat_algo_ops; | 358 | struct bat_algo_ops *bat_algo_ops; |
354 | int ret = -1; | 359 | int ret = -EINVAL; |
355 | 360 | ||
356 | bat_algo_ops = bat_algo_get(name); | 361 | bat_algo_ops = bat_algo_get(name); |
357 | if (!bat_algo_ops) | 362 | if (!bat_algo_ops) |
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) | |||
50 | int originator_init(struct bat_priv *bat_priv) | 50 | int 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 | ||
63 | err: | 63 | err: |
64 | return 0; | 64 | return -ENOMEM; |
65 | } | 65 | } |
66 | 66 | ||
67 | void neigh_node_free_ref(struct neigh_node *neigh_node) | 67 | void 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(); |
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index f9675b7f5f99..24e691d7275c 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -181,14 +181,14 @@ int tt_len(int changes_num) | |||
181 | static int tt_local_init(struct bat_priv *bat_priv) | 181 | static int tt_local_init(struct bat_priv *bat_priv) |
182 | { | 182 | { |
183 | if (bat_priv->tt_local_hash) | 183 | if (bat_priv->tt_local_hash) |
184 | return 1; | 184 | return 0; |
185 | 185 | ||
186 | bat_priv->tt_local_hash = hash_new(1024); | 186 | bat_priv->tt_local_hash = hash_new(1024); |
187 | 187 | ||
188 | if (!bat_priv->tt_local_hash) | 188 | if (!bat_priv->tt_local_hash) |
189 | return 0; | 189 | return -ENOMEM; |
190 | 190 | ||
191 | return 1; | 191 | return 0; |
192 | } | 192 | } |
193 | 193 | ||
194 | void tt_local_add(struct net_device *soft_iface, const uint8_t *addr, | 194 | void tt_local_add(struct net_device *soft_iface, const uint8_t *addr, |
@@ -491,14 +491,14 @@ static void tt_local_table_free(struct bat_priv *bat_priv) | |||
491 | static int tt_global_init(struct bat_priv *bat_priv) | 491 | static int tt_global_init(struct bat_priv *bat_priv) |
492 | { | 492 | { |
493 | if (bat_priv->tt_global_hash) | 493 | if (bat_priv->tt_global_hash) |
494 | return 1; | 494 | return 0; |
495 | 495 | ||
496 | bat_priv->tt_global_hash = hash_new(1024); | 496 | bat_priv->tt_global_hash = hash_new(1024); |
497 | 497 | ||
498 | if (!bat_priv->tt_global_hash) | 498 | if (!bat_priv->tt_global_hash) |
499 | return 0; | 499 | return -ENOMEM; |
500 | 500 | ||
501 | return 1; | 501 | return 0; |
502 | } | 502 | } |
503 | 503 | ||
504 | static void tt_changes_list_free(struct bat_priv *bat_priv) | 504 | static void tt_changes_list_free(struct bat_priv *bat_priv) |
@@ -1773,11 +1773,15 @@ out: | |||
1773 | 1773 | ||
1774 | int tt_init(struct bat_priv *bat_priv) | 1774 | int tt_init(struct bat_priv *bat_priv) |
1775 | { | 1775 | { |
1776 | if (!tt_local_init(bat_priv)) | 1776 | int ret; |
1777 | return 0; | ||
1778 | 1777 | ||
1779 | if (!tt_global_init(bat_priv)) | 1778 | ret = tt_local_init(bat_priv); |
1780 | return 0; | 1779 | if (ret < 0) |
1780 | return ret; | ||
1781 | |||
1782 | ret = tt_global_init(bat_priv); | ||
1783 | if (ret < 0) | ||
1784 | return ret; | ||
1781 | 1785 | ||
1782 | tt_start_timer(bat_priv); | 1786 | tt_start_timer(bat_priv); |
1783 | 1787 | ||
diff --git a/net/batman-adv/vis.c b/net/batman-adv/vis.c index cec216fb77c7..411c0e16f911 100644 --- a/net/batman-adv/vis.c +++ b/net/batman-adv/vis.c | |||
@@ -626,7 +626,7 @@ static int generate_vis_packet(struct bat_priv *bat_priv) | |||
626 | best_tq = find_best_vis_server(bat_priv, info); | 626 | best_tq = find_best_vis_server(bat_priv, info); |
627 | 627 | ||
628 | if (best_tq < 0) | 628 | if (best_tq < 0) |
629 | return -1; | 629 | return best_tq; |
630 | } | 630 | } |
631 | 631 | ||
632 | for (i = 0; i < hash->size; i++) { | 632 | for (i = 0; i < hash->size; i++) { |
@@ -878,7 +878,7 @@ int vis_init(struct bat_priv *bat_priv) | |||
878 | int hash_added; | 878 | int hash_added; |
879 | 879 | ||
880 | if (bat_priv->vis_hash) | 880 | if (bat_priv->vis_hash) |
881 | return 1; | 881 | return 0; |
882 | 882 | ||
883 | spin_lock_bh(&bat_priv->vis_hash_lock); | 883 | spin_lock_bh(&bat_priv->vis_hash_lock); |
884 | 884 | ||
@@ -929,7 +929,7 @@ int vis_init(struct bat_priv *bat_priv) | |||
929 | 929 | ||
930 | spin_unlock_bh(&bat_priv->vis_hash_lock); | 930 | spin_unlock_bh(&bat_priv->vis_hash_lock); |
931 | start_vis_timer(bat_priv); | 931 | start_vis_timer(bat_priv); |
932 | return 1; | 932 | return 0; |
933 | 933 | ||
934 | free_info: | 934 | free_info: |
935 | kfree(bat_priv->my_vis_info); | 935 | kfree(bat_priv->my_vis_info); |
@@ -937,7 +937,7 @@ free_info: | |||
937 | err: | 937 | err: |
938 | spin_unlock_bh(&bat_priv->vis_hash_lock); | 938 | spin_unlock_bh(&bat_priv->vis_hash_lock); |
939 | vis_quit(bat_priv); | 939 | vis_quit(bat_priv); |
940 | return 0; | 940 | return -ENOMEM; |
941 | } | 941 | } |
942 | 942 | ||
943 | /* Decrease the reference count on a hash item info */ | 943 | /* Decrease the reference count on a hash item info */ |