netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] net: ipv4: Remove redundant NULL check
@ 2013-03-05 11:27 Sachin Kamat
  2013-03-05 19:40 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Sachin Kamat @ 2013-03-05 11:27 UTC (permalink / raw)
  To: netdev; +Cc: davem, sachin.kamat

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] net: ipv4: Remove redundant NULL check
  2013-03-05 11:27 [PATCH 1/1] net: ipv4: Remove redundant NULL check Sachin Kamat
@ 2013-03-05 19:40 ` David Miller
  2013-03-06  3:15   ` Sachin Kamat
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2013-03-05 19:40 UTC (permalink / raw)
  To: sachin.kamat; +Cc: netdev

From: Sachin Kamat <sachin.kamat@linaro.org>
Date: Tue,  5 Mar 2013 16:57:09 +0530

> kfree on a null pointer is a NO-OP. Hence null check is not necessary.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>

Unnecessary writes to the socket struct should be avoided, as it
generates unnecessary write traffic to the L2 cache.

I'm not applying this.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] net: ipv4: Remove redundant NULL check
  2013-03-05 19:40 ` David Miller
@ 2013-03-06  3:15   ` Sachin Kamat
  0 siblings, 0 replies; 3+ messages in thread
From: Sachin Kamat @ 2013-03-06  3:15 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On 6 March 2013 01:10, David Miller <davem@davemloft.net> wrote:
> From: Sachin Kamat <sachin.kamat@linaro.org>
> Date: Tue,  5 Mar 2013 16:57:09 +0530
>
>> kfree on a null pointer is a NO-OP. Hence null check is not necessary.
>>
>> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
>
> Unnecessary writes to the socket struct should be avoided, as it
> generates unnecessary write traffic to the L2 cache.

Sounds reasonable.

>
> I'm not applying this.

Ok. No problem.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-03-06  3:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-05 11:27 [PATCH 1/1] net: ipv4: Remove redundant NULL check Sachin Kamat
2013-03-05 19:40 ` David Miller
2013-03-06  3:15   ` Sachin Kamat

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).