batman-adv: refactor window_protected to avoid unnecessary return statement
authorMarek Lindner <lindner_marek@yahoo.de>
Sat, 17 Mar 2012 07:28:33 +0000 (15:28 +0800)
committerAntonio Quartulli <ordex@autistici.org>
Sun, 13 May 2012 17:06:40 +0000 (19:06 +0200)
Reported-by: David Laight <David.Laight@aculab.com>
Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
net/batman-adv/routing.c

index b1824bb..840e2c6 100644 (file)
@@ -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;
 }