Skip to content

Commit

Permalink
hamradio: Delete unnecessary checks before the macro call “dev_kfree_…
Browse files Browse the repository at this point in the history
…skb”

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>
  • Loading branch information
Markus Elfring authored and David S. Miller committed Aug 22, 2019
1 parent 038dab7 commit b7deac3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions drivers/net/hamradio/baycom_epp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/hamradio/hdlcdrv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b7deac3

Please sign in to comment.