[B.A.T.M.A.N.] [PATCH 2/4] batman-adv: refactor window_protected to avoid unnecessary return statement

Marek Lindner
2012-03-17T07:28:33Z

Reported-by: David Laight <David.Laight@aculab.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
---
routing.c | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/routing.c b/routing.c
index 962a315..73aa20e 100644
--- a/routing.c
+++ b/routing.c
@@ -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;
}

--
1.7.9.1