From: Sven Eckelmann <sven@narfation.org>
With both locked sections moved to their own helpers, the only thing left
in the cleanup section is the reference of the looked up entry. The "out"
label is therefore only reached with a valid entry, except for the lookup
failure at the very beginning.
Return BATADV_NO_FLAGS directly when there is no entry and let the two
remaining cases be an if/else.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
net/batman-adv/translation-table.c | 26 ++++++++++----------------
1 file changed, 10 insertions(+), 16 deletions(-)
diff --git a/net/batman-adv/translation-table.c b/net/batman-adv/translation-table.c
index 9f61797c64920..6c65d195f3756 100644
--- a/net/batman-adv/translation-table.c
+++ b/net/batman-adv/translation-table.c
@@ -1526,13 +1526,12 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr,
bool roaming)
{
struct batadv_tt_local_entry *tt_local_entry;
- u16 curr_flags = BATADV_NO_FLAGS;
- bool pending = false;
+ u16 curr_flags;
u16 flags;
tt_local_entry = batadv_tt_local_hash_find(bat_priv, addr, vid);
if (!tt_local_entry)
- goto out;
+ return BATADV_NO_FLAGS;
flags = BATADV_TT_CLIENT_DEL;
/* if this global entry addition is due to a roaming, the node has to@@ -1542,20 +1541,15 @@ u16 batadv_tt_local_remove(struct batadv_priv *bat_priv, const u8 *addr,
if (roaming)
flags |= BATADV_TT_CLIENT_ROAM;
- pending = batadv_tt_local_mark_removed(tt_local_entry, roaming,
- &curr_flags);
- if (pending) {
- batadv_tt_local_set_pending_event(bat_priv, tt_local_entry, flags,
- message);
- goto out;
- }
-
- /* if this client has been added right now, it is possible to
- * immediately purge it
- */
- batadv_tt_local_remove_now(bat_priv, tt_local_entry);
+ if (batadv_tt_local_mark_removed(tt_local_entry, roaming, &curr_flags))
+ batadv_tt_local_set_pending_event(bat_priv, tt_local_entry,
+ flags, message);
+ else
+ /* if this client has been added right now, it is possible to
+ * immediately purge it
+ */
+ batadv_tt_local_remove_now(bat_priv, tt_local_entry);
-out:
batadv_tt_local_entry_put(tt_local_entry);
return curr_flags;--
2.47.3