OSDN Git Service

net: openvswitch: Remove unnecessary skb_nfct()
authorYejune Deng <yejune.deng@gmail.com>
Sat, 8 May 2021 02:27:07 +0000 (10:27 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 May 2021 21:18:19 +0000 (14:18 -0700)
There is no need add 'if (skb_nfct(skb))' assignment, the
nf_conntrack_put() would check it.

Signed-off-by: Yejune Deng <yejunedeng@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/openvswitch/conntrack.c

index cadb6a2..1b5eae5 100644 (file)
@@ -967,8 +967,7 @@ static int __ovs_ct_lookup(struct net *net, struct sw_flow_key *key,
 
                /* Associate skb with specified zone. */
                if (tmpl) {
-                       if (skb_nfct(skb))
-                               nf_conntrack_put(skb_nfct(skb));
+                       nf_conntrack_put(skb_nfct(skb));
                        nf_conntrack_get(&tmpl->ct_general);
                        nf_ct_set(skb, tmpl, IP_CT_NEW);
                }
@@ -1329,11 +1328,9 @@ int ovs_ct_execute(struct net *net, struct sk_buff *skb,
 
 int ovs_ct_clear(struct sk_buff *skb, struct sw_flow_key *key)
 {
-       if (skb_nfct(skb)) {
-               nf_conntrack_put(skb_nfct(skb));
-               nf_ct_set(skb, NULL, IP_CT_UNTRACKED);
-               ovs_ct_fill_key(skb, key, false);
-       }
+       nf_conntrack_put(skb_nfct(skb));
+       nf_ct_set(skb, NULL, IP_CT_UNTRACKED);
+       ovs_ct_fill_key(skb, key, false);
 
        return 0;
 }