mISDN: Delete unnecessary checks before the macro call “dev_kfree_skb”
authorMarkus Elfring <elfring@users.sourceforge.net>
Wed, 21 Aug 2019 18:10:56 +0000 (20:10 +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/isdn/hardware/mISDN/avmfritz.c
drivers/isdn/hardware/mISDN/hfcpci.c
drivers/isdn/hardware/mISDN/mISDNipac.c
drivers/isdn/hardware/mISDN/mISDNisar.c
drivers/isdn/hardware/mISDN/netjet.c
drivers/isdn/hardware/mISDN/w6692.c
drivers/isdn/mISDN/l1oip_core.c
drivers/isdn/mISDN/layer2.c
drivers/isdn/mISDN/stack.c
drivers/isdn/mISDN/tei.c

index 81f2b183acc857cb6d12d970a103ea184d153abd..1137dd152b5cb7f6a2cd2ac43a84c3e9394f268b 100644 (file)
@@ -509,8 +509,7 @@ HDLC_irq_xpr(struct bchannel *bch)
        if (bch->tx_skb && bch->tx_idx < bch->tx_skb->len) {
                hdlc_fill_fifo(bch);
        } else {
-               if (bch->tx_skb)
-                       dev_kfree_skb(bch->tx_skb);
+               dev_kfree_skb(bch->tx_skb);
                if (get_next_bframe(bch)) {
                        hdlc_fill_fifo(bch);
                        test_and_clear_bit(FLG_TX_EMPTY, &bch->Flags);
index 4a069582fc6b6b1dcfa064739e872529b05448e9..2330a7d24267951de7880bd7d75f48abd3bac940 100644 (file)
@@ -1119,8 +1119,7 @@ tx_birq(struct bchannel *bch)
        if (bch->tx_skb && bch->tx_idx < bch->tx_skb->len)
                hfcpci_fill_fifo(bch);
        else {
-               if (bch->tx_skb)
-                       dev_kfree_skb(bch->tx_skb);
+               dev_kfree_skb(bch->tx_skb);
                if (get_next_bframe(bch))
                        hfcpci_fill_fifo(bch);
        }
@@ -1132,8 +1131,7 @@ tx_dirq(struct dchannel *dch)
        if (dch->tx_skb && dch->tx_idx < dch->tx_skb->len)
                hfcpci_fill_dfifo(dch->hw);
        else {
-               if (dch->tx_skb)
-                       dev_kfree_skb(dch->tx_skb);
+               dev_kfree_skb(dch->tx_skb);
                if (get_next_dframe(dch))
                        hfcpci_fill_dfifo(dch->hw);
        }
index f915399d75cac83849c8fc9b555ee18125888f59..bca880213e9192b34c10d12890ae9c4a65cf2f22 100644 (file)
@@ -190,8 +190,7 @@ isac_rme_irq(struct isac_hw *isac)
 #endif
                }
                WriteISAC(isac, ISAC_CMDR, 0x80);
-               if (isac->dch.rx_skb)
-                       dev_kfree_skb(isac->dch.rx_skb);
+               dev_kfree_skb(isac->dch.rx_skb);
                isac->dch.rx_skb = NULL;
        } else {
                count = ReadISAC(isac, ISAC_RBCL) & 0x1f;
@@ -210,8 +209,7 @@ isac_xpr_irq(struct isac_hw *isac)
        if (isac->dch.tx_skb && isac->dch.tx_idx < isac->dch.tx_skb->len) {
                isac_fill_fifo(isac);
        } else {
-               if (isac->dch.tx_skb)
-                       dev_kfree_skb(isac->dch.tx_skb);
+               dev_kfree_skb(isac->dch.tx_skb);
                if (get_next_dframe(&isac->dch))
                        isac_fill_fifo(isac);
        }
@@ -464,8 +462,7 @@ isacsx_rme_irq(struct isac_hw *isac)
                        isac->dch.err_crc++;
 #endif
                WriteISAC(isac, ISACX_CMDRD, ISACX_CMDRD_RMC);
-               if (isac->dch.rx_skb)
-                       dev_kfree_skb(isac->dch.rx_skb);
+               dev_kfree_skb(isac->dch.rx_skb);
                isac->dch.rx_skb = NULL;
        } else {
                count = ReadISAC(isac, ISACX_RBCLD) & 0x1f;
@@ -1012,8 +1009,7 @@ hscx_xpr(struct hscx_hw *hx)
        if (hx->bch.tx_skb && hx->bch.tx_idx < hx->bch.tx_skb->len) {
                hscx_fill_fifo(hx);
        } else {
-               if (hx->bch.tx_skb)
-                       dev_kfree_skb(hx->bch.tx_skb);
+               dev_kfree_skb(hx->bch.tx_skb);
                if (get_next_bframe(&hx->bch)) {
                        hscx_fill_fifo(hx);
                        test_and_clear_bit(FLG_TX_EMPTY, &hx->bch.Flags);
index fd5c52f378023ae09785d31f2b1ebd027e818d41..4a3e748a1c26ed0a47573dc82c19a4c845aeac46 100644 (file)
@@ -690,8 +690,7 @@ send_next(struct isar_ch *ch)
                        }
                }
        }
-       if (ch->bch.tx_skb)
-               dev_kfree_skb(ch->bch.tx_skb);
+       dev_kfree_skb(ch->bch.tx_skb);
        if (get_next_bframe(&ch->bch)) {
                isar_fill_fifo(ch);
                test_and_clear_bit(FLG_TX_EMPTY, &ch->bch.Flags);
index 4e30affd1a7caed0a99f29debfb4a8235237ec2f..61caa7e50b9abac6360a26a87704f5b0e48c7895 100644 (file)
@@ -605,8 +605,7 @@ bc_next_frame(struct tiger_ch *bc)
        if (bc->bch.tx_skb && bc->bch.tx_idx < bc->bch.tx_skb->len) {
                fill_dma(bc);
        } else {
-               if (bc->bch.tx_skb)
-                       dev_kfree_skb(bc->bch.tx_skb);
+               dev_kfree_skb(bc->bch.tx_skb);
                if (get_next_bframe(&bc->bch)) {
                        fill_dma(bc);
                        test_and_clear_bit(FLG_TX_EMPTY, &bc->bch.Flags);
index 2402608dc98db4687d7a86a5c1d9f17812824b49..bad55fdacd36f0c5fb6de200d161e2021daf27e0 100644 (file)
@@ -356,8 +356,7 @@ handle_rxD(struct w6692_hw *card) {
                        card->dch.err_rx++;
 #endif
                }
-               if (card->dch.rx_skb)
-                       dev_kfree_skb(card->dch.rx_skb);
+               dev_kfree_skb(card->dch.rx_skb);
                card->dch.rx_skb = NULL;
                WriteW6692(card, W_D_CMDR, W_D_CMDR_RACK | W_D_CMDR_RRST);
        } else {
@@ -376,8 +375,7 @@ handle_txD(struct w6692_hw *card) {
        if (card->dch.tx_skb && card->dch.tx_idx < card->dch.tx_skb->len) {
                W6692_fill_Dfifo(card);
        } else {
-               if (card->dch.tx_skb)
-                       dev_kfree_skb(card->dch.tx_skb);
+               dev_kfree_skb(card->dch.tx_skb);
                if (get_next_dframe(&card->dch))
                        W6692_fill_Dfifo(card);
        }
@@ -636,8 +634,7 @@ send_next(struct w6692_ch *wch)
        if (wch->bch.tx_skb && wch->bch.tx_idx < wch->bch.tx_skb->len) {
                W6692_fill_Bfifo(wch);
        } else {
-               if (wch->bch.tx_skb)
-                       dev_kfree_skb(wch->bch.tx_skb);
+               dev_kfree_skb(wch->bch.tx_skb);
                if (get_next_bframe(&wch->bch)) {
                        W6692_fill_Bfifo(wch);
                        test_and_clear_bit(FLG_TX_EMPTY, &wch->bch.Flags);
index 447f241467bd854d52f0cd0d4d0dca3b76110c35..b57dcb834594de13eb1b90492a38b69a479f1b50 100644 (file)
@@ -1254,8 +1254,7 @@ release_card(struct l1oip *hc)
                        mISDN_freebchannel(hc->chan[ch].bch);
                        kfree(hc->chan[ch].bch);
 #ifdef REORDER_DEBUG
-                       if (hc->chan[ch].disorder_skb)
-                               dev_kfree_skb(hc->chan[ch].disorder_skb);
+                       dev_kfree_skb(hc->chan[ch].disorder_skb);
 #endif
                }
        }
index 68a4815167293300825eb2003f3c7d9d2596f379..5bf7fcb282c475366d74aa11e5ff05aeaa0581c0 100644 (file)
@@ -900,8 +900,7 @@ l2_disconnect(struct FsmInst *fi, int event, void *arg)
        send_uframe(l2, NULL, DISC | 0x10, CMD);
        mISDN_FsmDelTimer(&l2->t203, 1);
        restart_t200(l2, 2);
-       if (skb)
-               dev_kfree_skb(skb);
+       dev_kfree_skb(skb);
 }
 
 static void
@@ -1722,8 +1721,7 @@ l2_set_own_busy(struct FsmInst *fi, int event, void *arg)
                enquiry_cr(l2, RNR, RSP, 0);
                test_and_clear_bit(FLG_ACK_PEND, &l2->flag);
        }
-       if (skb)
-               dev_kfree_skb(skb);
+       dev_kfree_skb(skb);
 }
 
 static void
@@ -1736,8 +1734,7 @@ l2_clear_own_busy(struct FsmInst *fi, int event, void *arg)
                enquiry_cr(l2, RR, RSP, 0);
                test_and_clear_bit(FLG_ACK_PEND, &l2->flag);
        }
-       if (skb)
-               dev_kfree_skb(skb);
+       dev_kfree_skb(skb);
 }
 
 static void
index fa2237e7bcf8ddc723b3f7dfc8299948caddcbc2..27aa32914425d5d3b39e5047237c71e2bc5ce486 100644 (file)
@@ -75,8 +75,7 @@ send_socklist(struct mISDN_sock_list *sl, struct sk_buff *skb)
                        cskb = NULL;
        }
        read_unlock(&sl->lock);
-       if (cskb)
-               dev_kfree_skb(cskb);
+       dev_kfree_skb(cskb);
 }
 
 static void
@@ -134,8 +133,7 @@ send_layer2(struct mISDNstack *st, struct sk_buff *skb)
        }
 out:
        mutex_unlock(&st->lmutex);
-       if (skb)
-               dev_kfree_skb(skb);
+       dev_kfree_skb(skb);
 }
 
 static inline int
index a4fa594e1caf7e5f08c3fba2991ab41aea071bfd..59d28cb19738ee5d3f1b51617be7675205766b24 100644 (file)
@@ -1328,10 +1328,8 @@ mgr_bcast(struct mISDNchannel *ch, struct sk_buff *skb)
        }
 out:
        read_unlock_irqrestore(&mgr->lock, flags);
-       if (cskb)
-               dev_kfree_skb(cskb);
-       if (skb)
-               dev_kfree_skb(skb);
+       dev_kfree_skb(cskb);
+       dev_kfree_skb(skb);
        return 0;
 }