[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZkoGCpq1XN4t7wHS@casper.infradead.org>
Date: Sun, 19 May 2024 15:00:42 +0100
From: Matthew Wilcox <willy@...radead.org>
To: Markus Elfring <Markus.Elfring@....de>
Cc: Siddharth Vadapalli <s-vadapalli@...com>, netdev@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
kernel-janitors@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Jonathan Corbet <corbet@....net>,
MD Danish Anwar <danishanwar@...com>,
Paolo Abeni <pabeni@...hat.com>, Roger Quadros <rogerq@...nel.org>,
Vladimir Oltean <vladimir.oltean@....com>,
LKML <linux-kernel@...r.kernel.org>, linux-doc@...r.kernel.org,
Misael Lopez Cruz <misael.lopez@...com>,
Sriramakrishnan <srk@...com>, Vignesh Raghavendra <vigneshr@...com>
Subject: Re: [RFC PATCH net-next 12/28] net: ethernet: ti: cpsw-proxy-client:
add NAPI RX polling function
FYI, Markus can be safely ignored. His opinions are well-established as
being irrelevant.
On Sun, May 19, 2024 at 03:18:52PM +0200, Markus Elfring wrote:
> …
> > +++ b/drivers/net/ethernet/ti/cpsw-proxy-client.c
> …
> > @@ -988,6 +994,189 @@ static int vport_tx_poll(struct napi_struct *napi_tx, int budget)
> …
> > +static int vport_rx_packets(struct virtual_port *vport, u32 rx_chan_idx)
> > +{
> …
> > + if (unlikely(!netif_running(skb->dev))) {
> > + dev_kfree_skb_any(skb);
> > + return -ENODEV;
> > + }
>
> I suggest to move such exception handling to the end of this function implementation
> so that it can be better reused also by another if branch.
> https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources
>
> How do you think about to increase the application of scope-based resource management
> also for such a software component?
> https://elixir.bootlin.com/linux/v6.9.1/source/include/linux/cleanup.h
>
> Regards,
> Markus
>
Powered by blists - more mailing lists