Commit 7fd551a8 authored by Qianqiang Liu's avatar Qianqiang Liu Committed by Jakub Kicinski

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: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarVadim Fedorenko <vadim.fedorenko@linux.dev>
Reviewed-by: default avatarOleksij Rempel <o.rempel@pengutronix.de>
Link: https://lore.kernel.org/20240911135828.378317-1-usama.anjum@collabora.comSigned-off-by: default avatarQianqiang Liu <qianqiang.liu@163.com>
Link: https://patch.msgid.link/20240913014731.149739-1-qianqiang.liu@163.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent ef17c3d2
...@@ -1616,7 +1616,6 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit) ...@@ -1616,7 +1616,6 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit)
unsigned int i = ring->curr & ring_mask; unsigned int i = ring->curr & ring_mask;
struct ag71xx_desc *desc = ag71xx_ring_desc(ring, i); struct ag71xx_desc *desc = ag71xx_ring_desc(ring, i);
int pktlen; int pktlen;
int err = 0;
if (ag71xx_desc_empty(desc)) if (ag71xx_desc_empty(desc))
break; break;
...@@ -1639,6 +1638,7 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit) ...@@ -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)); skb = napi_build_skb(ring->buf[i].rx.rx_buf, ag71xx_buffer_size(ag));
if (!skb) { if (!skb) {
ndev->stats.rx_errors++;
skb_free_frag(ring->buf[i].rx.rx_buf); skb_free_frag(ring->buf[i].rx.rx_buf);
goto next; goto next;
} }
...@@ -1646,14 +1646,9 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit) ...@@ -1646,14 +1646,9 @@ static int ag71xx_rx_packets(struct ag71xx *ag, int limit)
skb_reserve(skb, offset); skb_reserve(skb, offset);
skb_put(skb, pktlen); skb_put(skb, pktlen);
if (err) {
ndev->stats.rx_dropped++;
kfree_skb(skb);
} else {
skb->dev = ndev; skb->dev = ndev;
skb->ip_summed = CHECKSUM_NONE; skb->ip_summed = CHECKSUM_NONE;
list_add_tail(&skb->list, &rx_list); list_add_tail(&skb->list, &rx_list);
}
next: next:
ring->buf[i].rx.rx_buf = NULL; ring->buf[i].rx.rx_buf = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment