diff mbox series

[v2] net: ag71xx: remove dead code path

Message ID 20240913014731.149739-1-qianqiang.liu@163.com (mailing list archive)
State Accepted
Commit 7fd551a87ba427fee2df8af4d83f4b7c220cc9dd
Delegated to: Netdev Maintainers
Headers show
Series [v2] net: ag71xx: remove dead code path | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 2 maintainers not CCed: pabeni@redhat.com chris.snook@gmail.com
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 31 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Qianqiang Liu Sept. 13, 2024, 1:47 a.m. UTC
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

Signed-off-by: Qianqiang Liu <qianqiang.liu@163.com>
---
Changes since v1:
 - Use "ndev->stats.rx_errors" to count "napi_build_skb()" failure
---
 drivers/net/ethernet/atheros/ag71xx.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Sept. 14, 2024, 3 a.m. UTC | #1
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Fri, 13 Sep 2024 09:47:32 +0800 you wrote:
> 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.
> 
> [...]

Here is the summary with links:
  - [v2] net: ag71xx: remove dead code path
    https://git.kernel.org/netdev/net-next/c/7fd551a87ba4

You are awesome, thank you!
diff mbox series

Patch

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;