[RFC PATCH net-next 12/28] net: ethernet: ti: cpsw-proxy-client: add NAPI RX polling function

Markus Elfring Markus.Elfring at web.de
Sun May 19 06:18:52 PDT 2024


…
> +++ 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



More information about the linux-arm-kernel mailing list