Netdev List
 help / color / mirror / Atom feed
From: Antonio Quartulli <ordex@autistici.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, b.a.t.m.a.n@lists.open-mesh.org,
	Marek Lindner <lindner_marek@yahoo.de>,
	Antonio Quartulli <ordex@autistici.org>
Subject: [PATCH 4/8] batman-adv: refactor window_protected to avoid unnecessary return statement
Date: Mon, 14 May 2012 09:17:34 +0200	[thread overview]
Message-ID: <1336979858-13928-5-git-send-email-ordex@autistici.org> (raw)
In-Reply-To: <1336979858-13928-1-git-send-email-ordex@autistici.org>

From: Marek Lindner <lindner_marek@yahoo.de>

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 |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index b1824bb..840e2c6 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/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.4

  parent reply	other threads:[~2012-05-14  7:17 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-14  7:17 pull request: batman-adv 2012-05-14 Antonio Quartulli
2012-05-14  7:17 ` [PATCH 1/8] batman-adv: avoid skb_linearise() if not needed Antonio Quartulli
2012-05-14  7:17 ` [PATCH 2/8] batman-adv: improve unicast packet (re)routing Antonio Quartulli
2012-05-14  7:17 ` [PATCH 3/8] batman-adv: prepare lq_update_lock to be shared among different protocols Antonio Quartulli
2012-05-14  7:17 ` Antonio Quartulli [this message]
2012-05-14  7:17 ` [PATCH 5/8] batman-adv: use shorter pr_warn instead of pr_warning Antonio Quartulli
2012-05-14  7:17 ` [PATCH 6/8] batman-adv: Start new development cycle Antonio Quartulli
2012-05-14  7:17 ` [PATCH 7/8] batman-adv: README cleanups Antonio Quartulli
2012-05-14  7:17 ` [PATCH 8/8] batman-adv: unset the TT_CLIENT_PENDING flag if the new local entry already exists Antonio Quartulli
     [not found] ` <1336979858-13928-1-git-send-email-ordex-GaUfNO9RBHfsrOwW+9ziJQ@public.gmane.org>
2012-05-14 22:17   ` pull request: batman-adv 2012-05-14 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1336979858-13928-5-git-send-email-ordex@autistici.org \
    --to=ordex@autistici.org \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    --cc=davem@davemloft.net \
    --cc=lindner_marek@yahoo.de \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox