Re: [PATCH] net: ag71xx: remove dead code path

From: Oleksij Rempel
Date: Wed Sep 11 2024 - 03:53:55 EST


On Tue, Sep 10, 2024 at 05:58:22PM +0200, Andrew Lunn wrote:
> On Tue, Sep 10, 2024 at 11:22:54PM +0800, Qianqiang Liu 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.
>
> This code was added by Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>. It is
> good to Cc: him, he might have useful comments.

Yes, please.

> Your changed does look correct, but maybe ret was actually supposed to
> be set somewhere? Is there an actual bug hiding here somewhere?

Hm, let's see... this issue existed in the openwrt code and I didn't
spotted it by upstreaming.

The only place which may fail in this part is napi_build_skb(), we will
need to count it probably with rx_errors++.

I'm ok with this patch, it can be reworked to use rx_errors++ on
napi_build_skb() instead or this can be done in a separate patch.

If you like to keep this patch as is, here is my:
Reviewed-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>

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 |