diff options
author | Marek Lindner <lindner_marek@yahoo.de> | 2012-08-03 11:15:46 -0400 |
---|---|---|
committer | Antonio Quartulli <ordex@autistici.org> | 2012-10-29 04:42:29 -0400 |
commit | 30da63a6af1dbf60e6d989faa4b984b1c6c9dfaf (patch) | |
tree | 6c596e108d2e0e65fe5914f71eef978076459b43 /net/batman-adv/translation-table.c | |
parent | f03a13a7167caeb550b3c424da1be691bfbe54ff (diff) |
batman-adv: consolidate duplicated primary_if checking code
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Diffstat (limited to 'net/batman-adv/translation-table.c')
-rw-r--r-- | net/batman-adv/translation-table.c | 36 |
1 files changed, 6 insertions, 30 deletions
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c index 112edd371b2f..d87d9b44ee4f 100644 --- a/net/batman-adv/translation-table.c +++ b/net/batman-adv/translation-table.c | |||
@@ -434,22 +434,10 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) | |||
434 | struct hlist_node *node; | 434 | struct hlist_node *node; |
435 | struct hlist_head *head; | 435 | struct hlist_head *head; |
436 | uint32_t i; | 436 | uint32_t i; |
437 | int ret = 0; | ||
438 | |||
439 | primary_if = batadv_primary_if_get_selected(bat_priv); | ||
440 | if (!primary_if) { | ||
441 | ret = seq_printf(seq, | ||
442 | "BATMAN mesh %s disabled - please specify interfaces to enable it\n", | ||
443 | net_dev->name); | ||
444 | goto out; | ||
445 | } | ||
446 | 437 | ||
447 | if (primary_if->if_status != BATADV_IF_ACTIVE) { | 438 | primary_if = batadv_seq_print_text_primary_if_get(seq); |
448 | ret = seq_printf(seq, | 439 | if (!primary_if) |
449 | "BATMAN mesh %s disabled - primary interface not active\n", | ||
450 | net_dev->name); | ||
451 | goto out; | 440 | goto out; |
452 | } | ||
453 | 441 | ||
454 | seq_printf(seq, | 442 | seq_printf(seq, |
455 | "Locally retrieved addresses (from %s) announced via TT (TTVN: %u):\n", | 443 | "Locally retrieved addresses (from %s) announced via TT (TTVN: %u):\n", |
@@ -479,7 +467,7 @@ int batadv_tt_local_seq_print_text(struct seq_file *seq, void *offset) | |||
479 | out: | 467 | out: |
480 | if (primary_if) | 468 | if (primary_if) |
481 | batadv_hardif_free_ref(primary_if); | 469 | batadv_hardif_free_ref(primary_if); |
482 | return ret; | 470 | return 0; |
483 | } | 471 | } |
484 | 472 | ||
485 | static void | 473 | static void |
@@ -842,22 +830,10 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset) | |||
842 | struct hlist_node *node; | 830 | struct hlist_node *node; |
843 | struct hlist_head *head; | 831 | struct hlist_head *head; |
844 | uint32_t i; | 832 | uint32_t i; |
845 | int ret = 0; | ||
846 | |||
847 | primary_if = batadv_primary_if_get_selected(bat_priv); | ||
848 | if (!primary_if) { | ||
849 | ret = seq_printf(seq, | ||
850 | "BATMAN mesh %s disabled - please specify interfaces to enable it\n", | ||
851 | net_dev->name); | ||
852 | goto out; | ||
853 | } | ||
854 | 833 | ||
855 | if (primary_if->if_status != BATADV_IF_ACTIVE) { | 834 | primary_if = batadv_seq_print_text_primary_if_get(seq); |
856 | ret = seq_printf(seq, | 835 | if (!primary_if) |
857 | "BATMAN mesh %s disabled - primary interface not active\n", | ||
858 | net_dev->name); | ||
859 | goto out; | 836 | goto out; |
860 | } | ||
861 | 837 | ||
862 | seq_printf(seq, | 838 | seq_printf(seq, |
863 | "Globally announced TT entries received via the mesh %s\n", | 839 | "Globally announced TT entries received via the mesh %s\n", |
@@ -881,7 +857,7 @@ int batadv_tt_global_seq_print_text(struct seq_file *seq, void *offset) | |||
881 | out: | 857 | out: |
882 | if (primary_if) | 858 | if (primary_if) |
883 | batadv_hardif_free_ref(primary_if); | 859 | batadv_hardif_free_ref(primary_if); |
884 | return ret; | 860 | return 0; |
885 | } | 861 | } |
886 | 862 | ||
887 | /* deletes the orig list of a tt_global_entry */ | 863 | /* deletes the orig list of a tt_global_entry */ |