batman-adv: return proper value in case of hash_add failure
authorAntonio Quartulli <ordex@autistici.org>
Sat, 11 Aug 2012 09:11:00 +0000 (11:11 +0200)
committerAntonio Quartulli <ordex@autistici.org>
Mon, 29 Oct 2012 08:42:31 +0000 (09:42 +0100)
In case of hash_add failure tt_global_add() must return 0 (which means on entry
insertion).

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
net/batman-adv/translation-table.c

index d87d9b44ee4fe1d166f92d6984ca2fdaf5e1d730..42a74e31b4ab4c48c5c035ece12640ec5ba6beeb 100644 (file)
@@ -776,13 +776,13 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv,
        batadv_dbg(BATADV_DBG_TT, bat_priv,
                   "Creating new global tt entry: %pM (via %pM)\n",
                   tt_global_entry->common.addr, orig_node->orig);
+       ret = 1;
 
 out_remove:
        /* remove address from local hash if present */
        batadv_tt_local_remove(bat_priv, tt_global_entry->common.addr,
                               "global tt received",
                               flags & BATADV_TT_CLIENT_ROAM);
-       ret = 1;
 out:
        if (tt_global_entry)
                batadv_tt_global_entry_free_ref(tt_global_entry);