net: usb: Delete unnecessary checks before the macro call “dev_kfree_skb”
authorMarkus Elfring <elfring@users.sourceforge.net>
Wed, 21 Aug 2019 20:16:02 +0000 (22:16 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 22 Aug 2019 23:22:03 +0000 (16:22 -0700)
The dev_kfree_skb() function performs also input parameter validation.
Thus the test around the shown 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: David S. Miller <davem@davemloft.net>
drivers/net/usb/lg-vl600.c
drivers/net/usb/rtl8150.c

index 6c2b3e368efec68663093a510f2a1c1f0c708587..217a2d8fa47b175cb016181f37c923c44b91fc93 100644 (file)
@@ -87,9 +87,7 @@ static void vl600_unbind(struct usbnet *dev, struct usb_interface *intf)
 {
        struct vl600_state *s = dev->driver_priv;
 
-       if (s->current_rx_buf)
-               dev_kfree_skb(s->current_rx_buf);
-
+       dev_kfree_skb(s->current_rx_buf);
        kfree(s);
 
        return usbnet_cdc_unbind(dev, intf);
index 98f33e270af12aa5c7b38b497673b49dc587749f..13e51ccf02147307f5ae85a64410680d6e8a3385 100644 (file)
@@ -586,8 +586,7 @@ static void free_skb_pool(rtl8150_t *dev)
        int i;
 
        for (i = 0; i < RX_SKB_POOL_SIZE; i++)
-               if (dev->rx_skb_pool[i])
-                       dev_kfree_skb(dev->rx_skb_pool[i]);
+               dev_kfree_skb(dev->rx_skb_pool[i]);
 }
 
 static void rx_fixup(unsigned long data)
@@ -946,8 +945,7 @@ static void rtl8150_disconnect(struct usb_interface *intf)
                unlink_all_urbs(dev);
                free_all_urbs(dev);
                free_skb_pool(dev);
-               if (dev->rx_skb)
-                       dev_kfree_skb(dev->rx_skb);
+               dev_kfree_skb(dev->rx_skb);
                kfree(dev->intr_buff);
                free_netdev(dev->netdev);
        }