Subject: Re: [PATCH net-next] net: airoha: Rework the code flow in airoha_remove() and in airoha_probe() error path

From: Simon Horman <[email-masked]>
Date: Sat, 21 Mar 2026 09:44:29 +0000

On Fri, Mar 20, 2026 at 09:42:28AM +0100, Lorenzo Bianconi wrote:
> As suggested by Simon in [0], rework the code flow in airoha_remove()
> and in the airoha_probe() error path in order to rely on a more common
> approach un-registering configured net-devices first and destroying the
> hw resources at the end of the code.
> Introduce airoha_qdma_cleanup routine to release QDMA resources.
> 
> [0] https://lore.kernel.org/netdev/[email-masked]/
> 
> Suggested-by: Simon Horman <[email-masked]>
> Signed-off-by: Lorenzo Bianconi <[email-masked]>
> ---
>  drivers/net/ethernet/airoha/airoha_eth.c | 82 ++++++++++++++++++--------------
>  1 file changed, 47 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c

...

> @@ -3028,7 +3044,7 @@ static int airoha_probe(struct platform_device *pdev)
>  
>  	err = airoha_hw_init(pdev, eth);
>  	if (err)
> -		goto error_hw_cleanup;
> +		return err;

Hi Lorenzo,

AI generated review warns that eth->napi_dev is leaked here.
And that does seem to be the case.

>  
>  	for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
>  		airoha_qdma_start_napi(&eth->qdma[i]);

...