diff options
author | Qianqiang Liu <qianqiang.liu@163.com> | 2024-09-13 09:47:32 +0800 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-09-13 19:53:47 -0700 |
commit | 7fd551a87ba427fee2df8af4d83f4b7c220cc9dd (patch) | |
tree | 6cd3078c6b5a8dca9a678f31d2849777d18508c1 /drivers/net/ethernet | |
parent | ef17c3d22cee57a857f3fbd3483d430fd5a44e1b (diff) | |
download | lwn-7fd551a87ba427fee2df8af4d83f4b7c220cc9dd.tar.gz lwn-7fd551a87ba427fee2df8af4d83f4b7c220cc9dd.zip |
net: ag71xx: remove dead code path
The "err" is always zero, so the following branch can never be executed:
if (err) {
ndev->stats.rx_dropped++;
kfree_skb(skb);
}
Therefore, the "if" statement can be removed.
Use "ndev->stats.rx_errors" to count "napi_build_skb()" failure
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/20240911135828.378317-1-usama.anjum@collabora.com
Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>
Link: https://patch.msgid.link/20240913014731.149739-1-qianqiang.liu@163.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r-- | drivers/net/ethernet/atheros/ag71xx.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c index 96a6189cc31e..9586b6894f7e 100644 --- a/drivers/net/ethernet/atheros/ag71xx.c +++ b/drivers/net/ethernet/atheros/ag71xx.c @@ -1616,7 +1616,6 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit) unsigned int i = ring->curr & ring_mask; struct ag71xx_desc *desc = ag71xx_ring_desc(ring, i); int pktlen; - int err = 0; if (ag71xx_desc_empty(desc)) break; @@ -1639,6 +1638,7 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit) skb = napi_build_skb(ring->buf[i].rx.rx_buf, ag71xx_buffer_size(ag)); if (!skb) { + ndev->stats.rx_errors++; skb_free_frag(ring->buf[i].rx.rx_buf); goto next; } @@ -1646,14 +1646,9 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit) skb_reserve(skb, offset); skb_put(skb, pktlen); - if (err) { - ndev->stats.rx_dropped++; - kfree_skb(skb); - } else { - skb->dev = ndev; - skb->ip_summed = CHECKSUM_NONE; - list_add_tail(&skb->list, &rx_list); - } + skb->dev = ndev; + skb->ip_summed = CHECKSUM_NONE; + list_add_tail(&skb->list, &rx_list); next: ring->buf[i].rx.rx_buf = NULL; |