Skip to content

Commit

Permalink
batman-adv: Use chain pointer when purging fragments
Browse files Browse the repository at this point in the history
The chain pointer was already created in batadv_frag_purge_orig to make the
checks more readable. Just use the chain pointer everywhere instead of
having the same dereference + array access in the most lines of this
function.

Signed-off-by: Sven Eckelmann <sven@narfation.org>
Acked-by: Martin Hundebøll <martin@hundeboll.net>
Signed-off-by: Marek Lindner <mareklindner@neomailbox.ch>
Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
  • Loading branch information
Sven Eckelmann authored and Antonio Quartulli committed Dec 16, 2015
1 parent ad7e2c4 commit 01f6b5c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/batman-adv/fragmentation.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,14 @@ void batadv_frag_purge_orig(struct batadv_orig_node *orig_node,

for (i = 0; i < BATADV_FRAG_BUFFER_COUNT; i++) {
chain = &orig_node->fragments[i];
spin_lock_bh(&orig_node->fragments[i].lock);
spin_lock_bh(&chain->lock);

if (!check_cb || check_cb(chain)) {
batadv_frag_clear_chain(&orig_node->fragments[i].head);
orig_node->fragments[i].size = 0;
batadv_frag_clear_chain(&chain->head);
chain->size = 0;
}

spin_unlock_bh(&orig_node->fragments[i].lock);
spin_unlock_bh(&chain->lock);
}
}

Expand Down

0 comments on commit 01f6b5c

Please sign in to comment.