On Tuesday 26 June 2012 22:00:18 Antonio Quartulli wrote:
diff --git a/translation-table.c b/translation-table.c index 245cc9a..0f02514 100644 --- a/translation-table.c +++ b/translation-table.c @@ -152,9 +152,12 @@ static void batadv_tt_orig_list_entry_free_rcu(struct rcu_head *rcu) static void batadv_tt_orig_list_entry_free_ref(struct batadv_tt_orig_list_entry *orig_entry) {
- /* to avoid race conditions, immediately decrease the tt counter */
- atomic_dec(&orig_entry->orig_node->tt_size);
- call_rcu(&orig_entry->rcu, batadv_tt_orig_list_entry_free_rcu);
- if (atomic_dec_and_test(&orig_entry->refcount)) {
/* to avoid race conditions, immediately decrease the tt counter
*/
atomic_dec(&orig_entry->orig_node->tt_size);
call_rcu(&orig_entry->rcu, batadv_tt_orig_list_entry_free_rcu);
- }
}
You can just invert the atomic_dec_and_test and use a return to avoid the weird comment.
[...]
static void batadv_tt_local_event(struct batadv_priv *bat_priv, @@ -639,12 +642,17 @@ batadv_tt_global_entry_has_orig(const struct batadv_tt_global_entry *entry, rcu_read_lock(); head = &entry->orig_list; hlist_for_each_entry_rcu(tmp_orig_entry, node, head, list) {
if (tmp_orig_entry->orig_node == orig_node) {
if (tmp_orig_entry->orig_node != orig_node)
continue;
if (!atomic_inc_not_zero(&tmp_orig_entry->refcount))
continue;
found = true;
batadv_tt_orig_list_entry_free_ref(tmp_orig_entry); break;
} rcu_read_unlock();}
Please fix the indentation in this patch and not in the later ones.
Kind regards, Sven