OSDN Git Service

rtlwifi: Delete unnecessary checks before the function call "kfree_skb"
authorMarkus Elfring <elfring@users.sourceforge.net>
Mon, 16 Nov 2015 12:12:25 +0000 (13:12 +0100)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 26 Nov 2015 12:55:27 +0000 (14:55 +0200)
The kfree_skb() function tests whether its argument is NULL and then
returns immediately. Thus the test around the calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/realtek/rtlwifi/core.c
drivers/net/wireless/realtek/rtlwifi/rtl8723com/fw_common.c

index c925a4d..4ae421e 100644 (file)
@@ -1833,8 +1833,7 @@ bool rtl_cmd_send_packet(struct ieee80211_hw *hw, struct sk_buff *skb)
 
        spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags);
        pskb = __skb_dequeue(&ring->queue);
-       if (pskb)
-               kfree_skb(pskb);
+       kfree_skb(pskb);
 
        /*this is wrong, fill_tx_cmddesc needs update*/
        pdesc = &ring->desc[0];
index a2f5e89..6e51862 100644 (file)
@@ -318,9 +318,7 @@ bool rtl8723_cmd_send_packet(struct ieee80211_hw *hw,
        ring = &rtlpci->tx_ring[BEACON_QUEUE];
 
        pskb = __skb_dequeue(&ring->queue);
-       if (pskb)
-               kfree_skb(pskb);
-
+       kfree_skb(pskb);
        spin_lock_irqsave(&rtlpriv->locks.irq_th_lock, flags);
 
        pdesc = &ring->desc[0];