Repository : ssh://git@open-mesh.org/batman-adv
On branch : next
commit b08dc3d9452d28944e7db09c2005c633b63f55e9 Author: Antonio Quartulli antonio@meshcoding.com Date: Wed Mar 19 18:57:35 2014 +0100
batman-adv: fix more code style
- use common iteration style pattern when looking up an object
Introduced by f2ed1502191a37abb39e3e2c80cca07f0f3bb411 ("batman-adv: Send multicast packets to nodes with a WANT_ALL flag")
Cc: Linux Lüssing linus.luessing@web.de Signed-off-by: Antonio Quartulli antonio@meshcoding.com Signed-off-by: Marek Lindner mareklindner@neomailbox.ch
b08dc3d9452d28944e7db09c2005c633b63f55e9 multicast.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-)
diff --git a/multicast.c b/multicast.c index dfe4cd6..8c7ca81 100644 --- a/multicast.c +++ b/multicast.c @@ -409,20 +409,20 @@ batadv_mcast_forw_tt_node_get(struct batadv_priv *bat_priv, static struct batadv_orig_node * batadv_mcast_forw_ipv4_node_get(struct batadv_priv *bat_priv) { - struct batadv_orig_node *orig_node; + struct batadv_orig_node *tmp_orig_node, *orig_node = NULL;
rcu_read_lock(); - hlist_for_each_entry_rcu(orig_node, + hlist_for_each_entry_rcu(tmp_orig_node, &bat_priv->mcast.want_all_ipv4_list, mcast_want_all_ipv4_node) { - if (atomic_inc_not_zero(&orig_node->refcount)) - goto unlock; - } - - orig_node = NULL; + if (!atomic_inc_not_zero(&orig_node->refcount)) + continue;
-unlock: + orig_node = tmp_orig_node; + break; + } rcu_read_unlock(); + return orig_node; }
@@ -436,20 +436,20 @@ unlock: static struct batadv_orig_node * batadv_mcast_forw_ipv6_node_get(struct batadv_priv *bat_priv) { - struct batadv_orig_node *orig_node; + struct batadv_orig_node *tmp_orig_node, *orig_node = NULL;
rcu_read_lock(); - hlist_for_each_entry_rcu(orig_node, + hlist_for_each_entry_rcu(tmp_orig_node, &bat_priv->mcast.want_all_ipv6_list, mcast_want_all_ipv6_node) { - if (atomic_inc_not_zero(&orig_node->refcount)) - goto unlock; - } - - orig_node = NULL; + if (!atomic_inc_not_zero(&orig_node->refcount)) + continue;
-unlock: + orig_node = tmp_orig_node; + break; + } rcu_read_unlock(); + return orig_node; }