aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/faraday/ftmac100.c
diff options
context:
space:
mode:
authorGustavo A. R. Silva <garsilva@embeddedor.com>2017-10-26 07:27:45 -0500
committerDavid S. Miller <davem@davemloft.net>2017-10-27 23:53:14 +0900
commit5bca178eed601cd4584c38c5290f7abbcacf3fb3 (patch)
treea2137e458ad0b95ae6aaae1717306c85dfbe912c /drivers/net/ethernet/faraday/ftmac100.c
parentnet: bcmgenet: Use BUG_ON instead of if condition followed by BUG (diff)
downloadlinux-dev-5bca178eed601cd4584c38c5290f7abbcacf3fb3.tar.xz
linux-dev-5bca178eed601cd4584c38c5290f7abbcacf3fb3.zip
net: faraday: ftmac100: Use BUG_ON instead of if condition followed by BUG.
Notice that in this particular case 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>
Diffstat (limited to 'drivers/net/ethernet/faraday/ftmac100.c')
-rw-r--r--drivers/net/ethernet/faraday/ftmac100.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/ethernet/faraday/ftmac100.c b/drivers/net/ethernet/faraday/ftmac100.c
index 66928a922824..aecc76504b69 100644
--- a/drivers/net/ethernet/faraday/ftmac100.c
+++ b/drivers/net/ethernet/faraday/ftmac100.c
@@ -402,6 +402,7 @@ static bool ftmac100_rx_packet(struct ftmac100 *priv, int *processed)
struct page *page;
dma_addr_t map;
int length;
+ bool ret;
rxdes = ftmac100_rx_locate_first_segment(priv);
if (!rxdes)
@@ -416,8 +417,8 @@ static bool ftmac100_rx_packet(struct ftmac100 *priv, int *processed)
* It is impossible to get multi-segment packets
* because we always provide big enough receive buffers.
*/
- if (unlikely(!ftmac100_rxdes_last_segment(rxdes)))
- BUG();
+ ret = ftmac100_rxdes_last_segment(rxdes);
+ BUG_ON(!ret);
/* start processing */
skb = netdev_alloc_skb_ip_align(netdev, 128);