Skip to content

Commit

Permalink
batman-adv: refactor window_protected to avoid unnecessary return sta…
Browse files Browse the repository at this point in the history
…tement

Reported-by: David Laight <[email protected]>
Signed-off-by: Marek Lindner <[email protected]>
Signed-off-by: Antonio Quartulli <[email protected]>
  • Loading branch information
Marek Lindner authored and Antonio Quartulli committed May 13, 2012
1 parent e3b0d0d commit 8c7bf24
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions net/batman-adv/routing.c
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,14 @@ int window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff,
{
if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) ||
(seq_num_diff >= EXPECTED_SEQNO_RANGE)) {
if (has_timed_out(*last_reset, RESET_PROTECTION_MS)) {

*last_reset = jiffies;
bat_dbg(DBG_BATMAN, bat_priv,
"old packet received, start protection\n");

return 0;
} else {
if (!has_timed_out(*last_reset, RESET_PROTECTION_MS))
return 1;
}

*last_reset = jiffies;
bat_dbg(DBG_BATMAN, bat_priv,
"old packet received, start protection\n");
}

return 0;
}

Expand Down

0 comments on commit 8c7bf24

Please sign in to comment.