hamradio: Delete unnecessary checks before the macro call “dev_kfree_skb”
authorMarkus Elfring <elfring@users.sourceforge.net>
Wed, 21 Aug 2019 19:48:46 +0000 (21:48 +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/hamradio/baycom_epp.c
drivers/net/hamradio/hdlcdrv.c

index 9303aeb2595f412cefa9ddcaca09ff93f9a4ecd8..4476491b58f9d3270467528f0d258247d273c52c 100644 (file)
@@ -961,8 +961,7 @@ static int epp_close(struct net_device *dev)
        parport_write_control(pp, 0); /* reset the adapter */
         parport_release(bc->pdev);
         parport_unregister_device(bc->pdev);
-       if (bc->skb)
-               dev_kfree_skb(bc->skb);
+       dev_kfree_skb(bc->skb);
        bc->skb = NULL;
        printk(KERN_INFO "%s: close epp at iobase 0x%lx irq %u\n",
               bc_drvname, dev->base_addr, dev->irq);
index c6f83e0df0a355f9ec0319f2a70950c49074f0d7..df495b5595f5f17bf609a61333db002a70ec7ade 100644 (file)
@@ -475,8 +475,7 @@ static int hdlcdrv_close(struct net_device *dev)
 
        if (s->ops && s->ops->close)
                i = s->ops->close(dev);
-       if (s->skb)
-               dev_kfree_skb(s->skb);
+       dev_kfree_skb(s->skb);
        s->skb = NULL;
        s->opened = 0;
        return i;