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

Lorenzo Bianconi lorenzo at kernel.org
Sat Mar 21 06:09:34 PDT 2026


On Mar 21, Simon Horman wrote:
> 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/20251214-airoha-fix-dev-registration-v1-1-860e027ad4c6@kernel.org/
> > 
> > Suggested-by: Simon Horman <horms at kernel.org>
> > Signed-off-by: Lorenzo Bianconi <lorenzo at kernel.org>
> > ---
> >  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.

Hi Simon,

right. I will fix it in v2.

Regards,
Lorenzo

> 
> >  
> >  	for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
> >  		airoha_qdma_start_napi(&eth->qdma[i]);
> 
> ...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-mediatek/attachments/20260321/28d35b9b/attachment.sig>


More information about the Linux-mediatek mailing list