[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <f5fcb385-6694-41ce-9e25-17a937c41562@linux.dev>
Date: Wed, 11 Sep 2024 14:26:19 +0100
From: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
To: Muhammad Usama Anjum <usama.anjum@...labora.com>,
Chris Snook <chris.snook@...il.com>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
Oleksij Rempel <o.rempel@...gutronix.de>, Andrew Lunn <andrew@...n.ch>
Cc: kernel@...labora.com, netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] net: ethernet: ag71xx: Remove dead code
On 11/09/2024 11:59, Muhammad Usama Anjum wrote:
> The err variable isn't being used anywhere other than getting
> initialized to 0 and then it is being checked in if condition. The
> condition can never be true. Remove the err and deadcode.
Indeed, there is no code to set err to something meaningful.
> Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@...labora.com>
> ---
> drivers/net/ethernet/atheros/ag71xx.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
> index db2a8ade62055..a90fc6834d53e 100644
> --- a/drivers/net/ethernet/atheros/ag71xx.c
> +++ b/drivers/net/ethernet/atheros/ag71xx.c
> @@ -1619,7 +1619,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;
> @@ -1649,14 +1648,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++;
I believe it's better to move this counter to if (!skb) block, otherwise
LGTM
> - 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;
Powered by blists - more mailing lists