Commit 8c7bf248 authored by Marek Lindner's avatar Marek Lindner Committed by Antonio Quartulli

batman-adv: refactor window_protected to avoid unnecessary return statement

Reported-by: default avatarDavid Laight <David.Laight@aculab.com>
Signed-off-by: default avatarMarek Lindner <lindner_marek@yahoo.de>
Signed-off-by: default avatarAntonio Quartulli <ordex@autistici.org>
parent e3b0d0de
...@@ -234,17 +234,14 @@ int window_protected(struct bat_priv *bat_priv, int32_t seq_num_diff, ...@@ -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) || if ((seq_num_diff <= -TQ_LOCAL_WINDOW_SIZE) ||
(seq_num_diff >= EXPECTED_SEQNO_RANGE)) { (seq_num_diff >= EXPECTED_SEQNO_RANGE)) {
if (has_timed_out(*last_reset, RESET_PROTECTION_MS)) { if (!has_timed_out(*last_reset, RESET_PROTECTION_MS))
return 1;
*last_reset = jiffies; *last_reset = jiffies;
bat_dbg(DBG_BATMAN, bat_priv, bat_dbg(DBG_BATMAN, bat_priv,
"old packet received, start protection\n"); "old packet received, start protection\n");
return 0;
} else {
return 1;
}
} }
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment