netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sachin Kamat <sachin.kamat@linaro.org>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, sachin.kamat@linaro.org
Subject: [PATCH 1/1] net: ipv4: Remove redundant NULL check
Date: Tue,  5 Mar 2013 16:57:09 +0530	[thread overview]
Message-ID: <1362482829-10455-1-git-send-email-sachin.kamat@linaro.org> (raw)

kfree on a null pointer is a NO-OP. Hence null check is not necessary.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
Compile tested on linux-next tree (20130305).
---
 net/ipv4/tcp.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 47e854f..3aa5d54 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -992,10 +992,8 @@ static inline int select_size(const struct sock *sk, bool sg)
 
 void tcp_free_fastopen_req(struct tcp_sock *tp)
 {
-	if (tp->fastopen_req != NULL) {
-		kfree(tp->fastopen_req);
-		tp->fastopen_req = NULL;
-	}
+	kfree(tp->fastopen_req);
+	tp->fastopen_req = NULL;
 }
 
 static int tcp_sendmsg_fastopen(struct sock *sk, struct msghdr *msg, int *size)
-- 
1.7.4.1

             reply	other threads:[~2013-03-05 11:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-05 11:27 Sachin Kamat [this message]
2013-03-05 19:40 ` [PATCH 1/1] net: ipv4: Remove redundant NULL check David Miller
2013-03-06  3:15   ` Sachin Kamat

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=1362482829-10455-1-git-send-email-sachin.kamat@linaro.org \
    --to=sachin.kamat@linaro.org \
    --cc=davem@davemloft.net \
    --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;
as well as URLs for NNTP newsgroup(s).