mctp: remove unnecessary check before calling kfree_skb()
authorYang Yingliang <yangyingliang@huawei.com>
Tue, 30 Nov 2021 03:12:43 +0000 (11:12 +0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 1 Dec 2021 02:09:23 +0000 (18:09 -0800)
The skb will be checked inside kfree_skb(), so remove the
outside check.

Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20211130031243.768823-1-yangyingliang@huawei.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/mctp/af_mctp.c
net/mctp/route.c

index 871cf62661258f2f2e53b71b42fe81b271304df0..c921de63b494b9cec696cd001cec3680a4a99338 100644 (file)
@@ -405,8 +405,7 @@ static void mctp_sk_unhash(struct sock *sk)
                trace_mctp_key_release(key, MCTP_TRACE_KEY_CLOSED);
 
                spin_lock(&key->lock);
-               if (key->reasm_head)
-                       kfree_skb(key->reasm_head);
+               kfree_skb(key->reasm_head);
                key->reasm_head = NULL;
                key->reasm_dead = true;
                key->valid = false;
index 46c44823edb7dd03a10804f737ae281ebb04b1ba..8d759b48f74705b16bcbc2edf077506f79843027 100644 (file)
@@ -231,9 +231,7 @@ static void __mctp_key_unlock_drop(struct mctp_sk_key *key, struct net *net,
        /* and one for the local reference */
        mctp_key_unref(key);
 
-       if (skb)
-               kfree_skb(skb);
-
+       kfree_skb(skb);
 }
 
 #ifdef CONFIG_MCTP_FLOWS