ipv6: Remove some pointless conditionals before kfree_skb()
authorWei Yongjun <yjwei@cn.fujitsu.com>
Mon, 23 Feb 2009 21:45:33 +0000 (21:45 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 25 Feb 2009 07:33:52 +0000 (23:33 -0800)
Remove some pointless conditionals before kfree_skb().

The semantic match that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@@
expression E;
@@
- if (E)
-  kfree_skb(E);
+ kfree_skb(E);
// </smpl>

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ipv6_sockglue.c
net/ipv6/tcp_ipv6.c

index 40f324655e2439cf6ba62dddecda75c9208a6c5c..d31df0f4bc9aa3ce017dc798a2af3be61a7a5c9a 100644 (file)
@@ -218,8 +218,7 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
                        if (opt)
                                sock_kfree_s(sk, opt, opt->tot_len);
                        pktopt = xchg(&np->pktoptions, NULL);
-                       if (pktopt)
-                               kfree_skb(pktopt);
+                       kfree_skb(pktopt);
 
                        sk->sk_destruct = inet_sock_destruct;
                        /*
index 00f1269e11e95e3691a388836592ef905433648b..4b5aa1854260642ec15fcb6124607dfba10f21b1 100644 (file)
@@ -533,8 +533,7 @@ static inline void syn_flood_warning(struct sk_buff *skb)
 
 static void tcp_v6_reqsk_destructor(struct request_sock *req)
 {
-       if (inet6_rsk(req)->pktopts)
-               kfree_skb(inet6_rsk(req)->pktopts);
+       kfree_skb(inet6_rsk(req)->pktopts);
 }
 
 #ifdef CONFIG_TCP_MD5SIG
@@ -1611,8 +1610,7 @@ ipv6_pktoptions:
                }
        }
 
-       if (opt_skb)
-               kfree_skb(opt_skb);
+       kfree_skb(opt_skb);
        return 0;
 }