netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] net: ethernet: ag71xx: Remove dead code
@ 2024-09-11 13:58 Muhammad Usama Anjum
  2024-09-11 14:24 ` Andrew Lunn
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Muhammad Usama Anjum @ 2024-09-11 13:58 UTC (permalink / raw)
  To: Chris Snook, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Andrew Lunn, Oleksij Rempel
  Cc: Muhammad Usama Anjum, kernel, netdev, linux-kernel

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.

Move the rx_dropped counter above when skb isn't found.

Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
Changes since v1:
- Move the rx_dropped counter above when skb isn't found.
---
 drivers/net/ethernet/atheros/ag71xx.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
index db2a8ade62055..2effceeb191db 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;
@@ -1643,20 +1642,16 @@ 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) {
 			skb_free_frag(ring->buf[i].rx.rx_buf);
+			ndev->stats.rx_dropped++;
 			goto next;
 		}
 
 		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;
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] net: ethernet: ag71xx: Remove dead code
  2024-09-11 13:58 [PATCH v2] net: ethernet: ag71xx: Remove dead code Muhammad Usama Anjum
@ 2024-09-11 14:24 ` Andrew Lunn
  2024-09-11 15:47 ` Vadim Fedorenko
  2024-09-11 18:20 ` Oleksij Rempel
  2 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2024-09-11 14:24 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Chris Snook, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Oleksij Rempel, kernel, netdev, linux-kernel

On Wed, Sep 11, 2024 at 06:58:27PM +0500, 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.
> 
> Move the rx_dropped counter above when skb isn't found.
> 
> Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] net: ethernet: ag71xx: Remove dead code
  2024-09-11 13:58 [PATCH v2] net: ethernet: ag71xx: Remove dead code Muhammad Usama Anjum
  2024-09-11 14:24 ` Andrew Lunn
@ 2024-09-11 15:47 ` Vadim Fedorenko
  2024-09-11 18:20 ` Oleksij Rempel
  2 siblings, 0 replies; 8+ messages in thread
From: Vadim Fedorenko @ 2024-09-11 15:47 UTC (permalink / raw)
  To: Muhammad Usama Anjum, Chris Snook, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Andrew Lunn, Oleksij Rempel
  Cc: kernel, netdev, linux-kernel

On 11/09/2024 14:58, 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.
> 
> Move the rx_dropped counter above when skb isn't found.
> 
> Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> ---
> Changes since v1:
> - Move the rx_dropped counter above when skb isn't found.
> ---
>   drivers/net/ethernet/atheros/ag71xx.c | 13 ++++---------
>   1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/ethernet/atheros/ag71xx.c b/drivers/net/ethernet/atheros/ag71xx.c
> index db2a8ade62055..2effceeb191db 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;
> @@ -1643,20 +1642,16 @@ 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) {
>   			skb_free_frag(ring->buf[i].rx.rx_buf);
> +			ndev->stats.rx_dropped++;
>   			goto next;
>   		}
>   
>   		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;


Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] net: ethernet: ag71xx: Remove dead code
  2024-09-11 13:58 [PATCH v2] net: ethernet: ag71xx: Remove dead code Muhammad Usama Anjum
  2024-09-11 14:24 ` Andrew Lunn
  2024-09-11 15:47 ` Vadim Fedorenko
@ 2024-09-11 18:20 ` Oleksij Rempel
  2024-09-12 15:56   ` Eric Dumazet
  2 siblings, 1 reply; 8+ messages in thread
From: Oleksij Rempel @ 2024-09-11 18:20 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Chris Snook, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, Andrew Lunn, kernel, netdev, linux-kernel

On Wed, Sep 11, 2024 at 06:58:27PM +0500, 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.
> 
> Move the rx_dropped counter above when skb isn't found.
> 
> Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
 
Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>

Thank you!

Regards,
Oleksij
-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] net: ethernet: ag71xx: Remove dead code
  2024-09-11 18:20 ` Oleksij Rempel
@ 2024-09-12 15:56   ` Eric Dumazet
  2024-09-12 16:28     ` Qianqiang Liu
  2024-09-13  0:42     ` Jakub Kicinski
  0 siblings, 2 replies; 8+ messages in thread
From: Eric Dumazet @ 2024-09-12 15:56 UTC (permalink / raw)
  To: Oleksij Rempel, Qianqiang Liu
  Cc: Muhammad Usama Anjum, Chris Snook, David S. Miller,
	Jakub Kicinski, Paolo Abeni, Andrew Lunn, kernel, netdev,
	linux-kernel

On Wed, Sep 11, 2024 at 8:20 PM Oleksij Rempel <o.rempel@pengutronix.de> wrote:
>
> On Wed, Sep 11, 2024 at 06:58:27PM +0500, 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.
> >
> > Move the rx_dropped counter above when skb isn't found.
> >
> > Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
> > Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
>
> Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
>
> Thank you!
>
> Regards,
> Oleksij

I do not see any credits given to  Qianqiang Liu, who is desperate to get his
first linux patch...

https://lore.kernel.org/netdev/20240910152254.21238-1-qianqiang.liu@163.com/

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] net: ethernet: ag71xx: Remove dead code
  2024-09-12 15:56   ` Eric Dumazet
@ 2024-09-12 16:28     ` Qianqiang Liu
  2024-09-13  0:42     ` Jakub Kicinski
  1 sibling, 0 replies; 8+ messages in thread
From: Qianqiang Liu @ 2024-09-12 16:28 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Oleksij Rempel, Muhammad Usama Anjum, Chris Snook,
	David S. Miller, Jakub Kicinski, Paolo Abeni, Andrew Lunn, kernel,
	netdev, linux-kernel

Hi Eric,

> I do not see any credits given to  Qianqiang Liu, who is desperate to get his
> first linux patch...
> 
> https://lore.kernel.org/netdev/20240910152254.21238-1-qianqiang.liu@163.com/

Yes, you are right! I'm a kernel newbie.
But Linux is a FOSS software, and anyone can contribute, right?
Actually, I have two patches that were merged into the linux-next branch:

https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=93497752dfed196b41d2804503e80b9a04318adb
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=cd0920ebab6bce93ac5054d621c0633f6a4d640b

-- 
Best,
Qianqiang Liu


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] net: ethernet: ag71xx: Remove dead code
  2024-09-12 15:56   ` Eric Dumazet
  2024-09-12 16:28     ` Qianqiang Liu
@ 2024-09-13  0:42     ` Jakub Kicinski
  2024-09-13  3:27       ` Jakub Kicinski
  1 sibling, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2024-09-13  0:42 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Eric Dumazet, Oleksij Rempel, Qianqiang Liu, Chris Snook,
	David S. Miller, Paolo Abeni, Andrew Lunn, kernel, netdev,
	linux-kernel

On Thu, 12 Sep 2024 17:56:11 +0200 Eric Dumazet wrote:
> On Wed, Sep 11, 2024 at 8:20 PM Oleksij Rempel <o.rempel@pengutronix.de> wrote:
> > On Wed, Sep 11, 2024 at 06:58:27PM +0500, 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.
> > >
> > > Move the rx_dropped counter above when skb isn't found.
> > >
> > > Fixes: d51b6ce441d3 ("net: ethernet: add ag71xx driver")
> > > Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>  
> >
> > Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de>
> 
> I do not see any credits given to  Qianqiang Liu, who is desperate to get his
> first linux patch...
> 
> https://lore.kernel.org/netdev/20240910152254.21238-1-qianqiang.liu@163.com/

Right, odd, is there a reason you took over from Qianqiang Liu?
Otherwise I'd prefer if they could send the next version.
Last thing we need is arguments about ownership of trivial
patches.

This v2 has an unnecessary Fixes tag, this is not a fix.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] net: ethernet: ag71xx: Remove dead code
  2024-09-13  0:42     ` Jakub Kicinski
@ 2024-09-13  3:27       ` Jakub Kicinski
  0 siblings, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2024-09-13  3:27 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Eric Dumazet, Oleksij Rempel, Qianqiang Liu, Chris Snook,
	David S. Miller, Paolo Abeni, Andrew Lunn, kernel, netdev,
	linux-kernel

On Thu, 12 Sep 2024 17:42:22 -0700 Jakub Kicinski wrote:
> On Thu, 12 Sep 2024 17:56:11 +0200 Eric Dumazet wrote:
> > I do not see any credits given to  Qianqiang Liu, who is desperate to get his
> > first linux patch...
> > 
> > https://lore.kernel.org/netdev/20240910152254.21238-1-qianqiang.liu@163.com/  
> 
> Right, odd, is there a reason you took over from Qianqiang Liu?
> Otherwise I'd prefer if they could send the next version.
> Last thing we need is arguments about ownership of trivial
> patches.
> 
> This v2 has an unnecessary Fixes tag, this is not a fix.

Oh, I guess it may be a v2 of your own change:

https://lore.kernel.org/all/20240911105924.4028423-1-usama.anjum@collabora.com/

Are you both using the same tool? 5 year old code and suddenly we get
the same fix two times.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-09-13  3:27 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-11 13:58 [PATCH v2] net: ethernet: ag71xx: Remove dead code Muhammad Usama Anjum
2024-09-11 14:24 ` Andrew Lunn
2024-09-11 15:47 ` Vadim Fedorenko
2024-09-11 18:20 ` Oleksij Rempel
2024-09-12 15:56   ` Eric Dumazet
2024-09-12 16:28     ` Qianqiang Liu
2024-09-13  0:42     ` Jakub Kicinski
2024-09-13  3:27       ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).