Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mISDN: Delete unnecessary checks before the macro call “dev_kfree_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>

authored by

Markus Elfring and committed by
David S. Miller
0f817a5e d3ee8ec7

+20 -40
+1 -2
drivers/isdn/hardware/mISDN/avmfritz.c
··· 509 509 if (bch->tx_skb && bch->tx_idx < bch->tx_skb->len) { 510 510 hdlc_fill_fifo(bch); 511 511 } else { 512 - if (bch->tx_skb) 513 - dev_kfree_skb(bch->tx_skb); 512 + dev_kfree_skb(bch->tx_skb); 514 513 if (get_next_bframe(bch)) { 515 514 hdlc_fill_fifo(bch); 516 515 test_and_clear_bit(FLG_TX_EMPTY, &bch->Flags);
+2 -4
drivers/isdn/hardware/mISDN/hfcpci.c
··· 1119 1119 if (bch->tx_skb && bch->tx_idx < bch->tx_skb->len) 1120 1120 hfcpci_fill_fifo(bch); 1121 1121 else { 1122 - if (bch->tx_skb) 1123 - dev_kfree_skb(bch->tx_skb); 1122 + dev_kfree_skb(bch->tx_skb); 1124 1123 if (get_next_bframe(bch)) 1125 1124 hfcpci_fill_fifo(bch); 1126 1125 } ··· 1131 1132 if (dch->tx_skb && dch->tx_idx < dch->tx_skb->len) 1132 1133 hfcpci_fill_dfifo(dch->hw); 1133 1134 else { 1134 - if (dch->tx_skb) 1135 - dev_kfree_skb(dch->tx_skb); 1135 + dev_kfree_skb(dch->tx_skb); 1136 1136 if (get_next_dframe(dch)) 1137 1137 hfcpci_fill_dfifo(dch->hw); 1138 1138 }
+4 -8
drivers/isdn/hardware/mISDN/mISDNipac.c
··· 190 190 #endif 191 191 } 192 192 WriteISAC(isac, ISAC_CMDR, 0x80); 193 - if (isac->dch.rx_skb) 194 - dev_kfree_skb(isac->dch.rx_skb); 193 + dev_kfree_skb(isac->dch.rx_skb); 195 194 isac->dch.rx_skb = NULL; 196 195 } else { 197 196 count = ReadISAC(isac, ISAC_RBCL) & 0x1f; ··· 209 210 if (isac->dch.tx_skb && isac->dch.tx_idx < isac->dch.tx_skb->len) { 210 211 isac_fill_fifo(isac); 211 212 } else { 212 - if (isac->dch.tx_skb) 213 - dev_kfree_skb(isac->dch.tx_skb); 213 + dev_kfree_skb(isac->dch.tx_skb); 214 214 if (get_next_dframe(&isac->dch)) 215 215 isac_fill_fifo(isac); 216 216 } ··· 462 464 isac->dch.err_crc++; 463 465 #endif 464 466 WriteISAC(isac, ISACX_CMDRD, ISACX_CMDRD_RMC); 465 - if (isac->dch.rx_skb) 466 - dev_kfree_skb(isac->dch.rx_skb); 467 + dev_kfree_skb(isac->dch.rx_skb); 467 468 isac->dch.rx_skb = NULL; 468 469 } else { 469 470 count = ReadISAC(isac, ISACX_RBCLD) & 0x1f; ··· 1009 1012 if (hx->bch.tx_skb && hx->bch.tx_idx < hx->bch.tx_skb->len) { 1010 1013 hscx_fill_fifo(hx); 1011 1014 } else { 1012 - if (hx->bch.tx_skb) 1013 - dev_kfree_skb(hx->bch.tx_skb); 1015 + dev_kfree_skb(hx->bch.tx_skb); 1014 1016 if (get_next_bframe(&hx->bch)) { 1015 1017 hscx_fill_fifo(hx); 1016 1018 test_and_clear_bit(FLG_TX_EMPTY, &hx->bch.Flags);
+1 -2
drivers/isdn/hardware/mISDN/mISDNisar.c
··· 690 690 } 691 691 } 692 692 } 693 - if (ch->bch.tx_skb) 694 - dev_kfree_skb(ch->bch.tx_skb); 693 + dev_kfree_skb(ch->bch.tx_skb); 695 694 if (get_next_bframe(&ch->bch)) { 696 695 isar_fill_fifo(ch); 697 696 test_and_clear_bit(FLG_TX_EMPTY, &ch->bch.Flags);
+1 -2
drivers/isdn/hardware/mISDN/netjet.c
··· 605 605 if (bc->bch.tx_skb && bc->bch.tx_idx < bc->bch.tx_skb->len) { 606 606 fill_dma(bc); 607 607 } else { 608 - if (bc->bch.tx_skb) 609 - dev_kfree_skb(bc->bch.tx_skb); 608 + dev_kfree_skb(bc->bch.tx_skb); 610 609 if (get_next_bframe(&bc->bch)) { 611 610 fill_dma(bc); 612 611 test_and_clear_bit(FLG_TX_EMPTY, &bc->bch.Flags);
+3 -6
drivers/isdn/hardware/mISDN/w6692.c
··· 356 356 card->dch.err_rx++; 357 357 #endif 358 358 } 359 - if (card->dch.rx_skb) 360 - dev_kfree_skb(card->dch.rx_skb); 359 + dev_kfree_skb(card->dch.rx_skb); 361 360 card->dch.rx_skb = NULL; 362 361 WriteW6692(card, W_D_CMDR, W_D_CMDR_RACK | W_D_CMDR_RRST); 363 362 } else { ··· 375 376 if (card->dch.tx_skb && card->dch.tx_idx < card->dch.tx_skb->len) { 376 377 W6692_fill_Dfifo(card); 377 378 } else { 378 - if (card->dch.tx_skb) 379 - dev_kfree_skb(card->dch.tx_skb); 379 + dev_kfree_skb(card->dch.tx_skb); 380 380 if (get_next_dframe(&card->dch)) 381 381 W6692_fill_Dfifo(card); 382 382 } ··· 634 636 if (wch->bch.tx_skb && wch->bch.tx_idx < wch->bch.tx_skb->len) { 635 637 W6692_fill_Bfifo(wch); 636 638 } else { 637 - if (wch->bch.tx_skb) 638 - dev_kfree_skb(wch->bch.tx_skb); 639 + dev_kfree_skb(wch->bch.tx_skb); 639 640 if (get_next_bframe(&wch->bch)) { 640 641 W6692_fill_Bfifo(wch); 641 642 test_and_clear_bit(FLG_TX_EMPTY, &wch->bch.Flags);
+1 -2
drivers/isdn/mISDN/l1oip_core.c
··· 1254 1254 mISDN_freebchannel(hc->chan[ch].bch); 1255 1255 kfree(hc->chan[ch].bch); 1256 1256 #ifdef REORDER_DEBUG 1257 - if (hc->chan[ch].disorder_skb) 1258 - dev_kfree_skb(hc->chan[ch].disorder_skb); 1257 + dev_kfree_skb(hc->chan[ch].disorder_skb); 1259 1258 #endif 1260 1259 } 1261 1260 }
+3 -6
drivers/isdn/mISDN/layer2.c
··· 900 900 send_uframe(l2, NULL, DISC | 0x10, CMD); 901 901 mISDN_FsmDelTimer(&l2->t203, 1); 902 902 restart_t200(l2, 2); 903 - if (skb) 904 - dev_kfree_skb(skb); 903 + dev_kfree_skb(skb); 905 904 } 906 905 907 906 static void ··· 1721 1722 enquiry_cr(l2, RNR, RSP, 0); 1722 1723 test_and_clear_bit(FLG_ACK_PEND, &l2->flag); 1723 1724 } 1724 - if (skb) 1725 - dev_kfree_skb(skb); 1725 + dev_kfree_skb(skb); 1726 1726 } 1727 1727 1728 1728 static void ··· 1734 1736 enquiry_cr(l2, RR, RSP, 0); 1735 1737 test_and_clear_bit(FLG_ACK_PEND, &l2->flag); 1736 1738 } 1737 - if (skb) 1738 - dev_kfree_skb(skb); 1739 + dev_kfree_skb(skb); 1739 1740 } 1740 1741 1741 1742 static void
+2 -4
drivers/isdn/mISDN/stack.c
··· 75 75 cskb = NULL; 76 76 } 77 77 read_unlock(&sl->lock); 78 - if (cskb) 79 - dev_kfree_skb(cskb); 78 + dev_kfree_skb(cskb); 80 79 } 81 80 82 81 static void ··· 133 134 } 134 135 out: 135 136 mutex_unlock(&st->lmutex); 136 - if (skb) 137 - dev_kfree_skb(skb); 137 + dev_kfree_skb(skb); 138 138 } 139 139 140 140 static inline int
+2 -4
drivers/isdn/mISDN/tei.c
··· 1328 1328 } 1329 1329 out: 1330 1330 read_unlock_irqrestore(&mgr->lock, flags); 1331 - if (cskb) 1332 - dev_kfree_skb(cskb); 1333 - if (skb) 1334 - dev_kfree_skb(skb); 1331 + dev_kfree_skb(cskb); 1332 + dev_kfree_skb(skb); 1335 1333 return 0; 1336 1334 } 1337 1335