net: bcmgenet: Use BUG_ON instead of if condition followed by BUG
authorGustavo A. R. Silva <garsilva@embeddedor.com>
Thu, 26 Oct 2017 12:16:01 +0000 (07:16 -0500)
committerDavid S. Miller <davem@davemloft.net>
Fri, 27 Oct 2017 14:52:36 +0000 (23:52 +0900)
Use BUG_ON instead of if condition followed by BUG.

Something to notice in this particular case is that unlikely()
is already being called inside BUG_ON macro.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/genet/bcmgenet.c

index 9713374ebf1454d00826454d3202b8a5c72e66e4..24b4f4ceceef0e388e6ed7734a41c3d025387534 100644 (file)
@@ -1580,8 +1580,7 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
        for (i = 0; i <= nr_frags; i++) {
                tx_cb_ptr = bcmgenet_get_txcb(priv, ring);
 
-               if (unlikely(!tx_cb_ptr))
-                       BUG();
+               BUG_ON(!tx_cb_ptr);
 
                if (!i) {
                        /* Transmit single SKB or head of fragment list */