* [PATCH] net: airoha: Fix an error handling path in airoha_probe()
@ 2025-04-18 11:57 Christophe JAILLET
2025-04-18 12:28 ` Lorenzo Bianconi
0 siblings, 1 reply; 5+ messages in thread
From: Christophe JAILLET @ 2025-04-18 11:57 UTC (permalink / raw)
To: Lorenzo Bianconi, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni
Cc: linux-kernel, kernel-janitors, Christophe JAILLET,
linux-arm-kernel, linux-mediatek, netdev
If an error occurs after a successful airoha_hw_init() call,
airoha_ppe_deinit() needs to be called as already done in the remove
function.
Fixes: 00a7678310fe ("net: airoha: Introduce flowtable offload support")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested-only
---
drivers/net/ethernet/airoha/airoha_eth.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
index 69e523dd4186..252b32ceb064 100644
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
@@ -2631,6 +2631,8 @@ static int airoha_probe(struct platform_device *pdev)
}
}
free_netdev(eth->napi_dev);
+
+ airoha_ppe_deinit(eth);
platform_set_drvdata(pdev, NULL);
return err;
--
2.49.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net: airoha: Fix an error handling path in airoha_probe()
2025-04-18 11:57 [PATCH] net: airoha: Fix an error handling path in airoha_probe() Christophe JAILLET
@ 2025-04-18 12:28 ` Lorenzo Bianconi
2025-04-29 14:22 ` Lorenzo Bianconi
2025-05-08 14:30 ` Christophe JAILLET
0 siblings, 2 replies; 5+ messages in thread
From: Lorenzo Bianconi @ 2025-04-18 12:28 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-kernel, kernel-janitors, linux-arm-kernel,
linux-mediatek, netdev
[-- Attachment #1: Type: text/plain, Size: 1745 bytes --]
> If an error occurs after a successful airoha_hw_init() call,
> airoha_ppe_deinit() needs to be called as already done in the remove
> function.
>
> Fixes: 00a7678310fe ("net: airoha: Introduce flowtable offload support")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Compile tested-only
> ---
> drivers/net/ethernet/airoha/airoha_eth.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
> index 69e523dd4186..252b32ceb064 100644
> --- a/drivers/net/ethernet/airoha/airoha_eth.c
> +++ b/drivers/net/ethernet/airoha/airoha_eth.c
> @@ -2631,6 +2631,8 @@ static int airoha_probe(struct platform_device *pdev)
> }
> }
> free_netdev(eth->napi_dev);
> +
> + airoha_ppe_deinit(eth);
> platform_set_drvdata(pdev, NULL);
>
> return err;
> --
> 2.49.0
>
Hi Christophe,
I agree we are missing a airoha_ppe_deinit() call in the probe error path,
but we should move it above after stopping the NAPI since if airoha_hw_init()
fails we will undo the work done by airoha_ppe_init(). Something like:
diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
index 16c7896f931f..37d9678798d1 100644
--- a/drivers/net/ethernet/airoha/airoha_eth.c
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
@@ -2959,6 +2959,7 @@ static int airoha_probe(struct platform_device *pdev)
error_napi_stop:
for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
airoha_qdma_stop_napi(ð->qdma[i]);
+ airoha_ppe_init(eth);
error_hw_cleanup:
for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
airoha_hw_cleanup(ð->qdma[i]);
Agree?
Regards,
Lorenzo
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] net: airoha: Fix an error handling path in airoha_probe()
2025-04-18 12:28 ` Lorenzo Bianconi
@ 2025-04-29 14:22 ` Lorenzo Bianconi
2025-04-29 20:55 ` Christophe JAILLET
2025-05-08 14:30 ` Christophe JAILLET
1 sibling, 1 reply; 5+ messages in thread
From: Lorenzo Bianconi @ 2025-04-29 14:22 UTC (permalink / raw)
To: Christophe JAILLET
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-kernel, kernel-janitors, linux-arm-kernel,
linux-mediatek, netdev
[-- Attachment #1: Type: text/plain, Size: 1928 bytes --]
> > If an error occurs after a successful airoha_hw_init() call,
> > airoha_ppe_deinit() needs to be called as already done in the remove
> > function.
> >
> > Fixes: 00a7678310fe ("net: airoha: Introduce flowtable offload support")
> > Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> > ---
> > Compile tested-only
> > ---
> > drivers/net/ethernet/airoha/airoha_eth.c | 2 ++
> > 1 file changed, 2 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
> > index 69e523dd4186..252b32ceb064 100644
> > --- a/drivers/net/ethernet/airoha/airoha_eth.c
> > +++ b/drivers/net/ethernet/airoha/airoha_eth.c
> > @@ -2631,6 +2631,8 @@ static int airoha_probe(struct platform_device *pdev)
> > }
> > }
> > free_netdev(eth->napi_dev);
> > +
> > + airoha_ppe_deinit(eth);
> > platform_set_drvdata(pdev, NULL);
> >
> > return err;
> > --
> > 2.49.0
> >
>
> Hi Christophe,
>
> I agree we are missing a airoha_ppe_deinit() call in the probe error path,
> but we should move it above after stopping the NAPI since if airoha_hw_init()
> fails we will undo the work done by airoha_ppe_init(). Something like:
>
> diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
> index 16c7896f931f..37d9678798d1 100644
> --- a/drivers/net/ethernet/airoha/airoha_eth.c
> +++ b/drivers/net/ethernet/airoha/airoha_eth.c
> @@ -2959,6 +2959,7 @@ static int airoha_probe(struct platform_device *pdev)
> error_napi_stop:
> for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
> airoha_qdma_stop_napi(ð->qdma[i]);
> + airoha_ppe_init(eth);
> error_hw_cleanup:
> for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
> airoha_hw_cleanup(ð->qdma[i]);
>
Hi Christophe,
any plan to repost this fix?
Regards,
Lorenzo
>
> Agree?
>
> Regards,
> Lorenzo
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: airoha: Fix an error handling path in airoha_probe()
2025-04-29 14:22 ` Lorenzo Bianconi
@ 2025-04-29 20:55 ` Christophe JAILLET
0 siblings, 0 replies; 5+ messages in thread
From: Christophe JAILLET @ 2025-04-29 20:55 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-kernel, kernel-janitors, linux-arm-kernel,
linux-mediatek, netdev
Le 29/04/2025 à 16:22, Lorenzo Bianconi a écrit :
>>> If an error occurs after a successful airoha_hw_init() call,
>>> airoha_ppe_deinit() needs to be called as already done in the remove
>>> function.
>>>
>>> Fixes: 00a7678310fe ("net: airoha: Introduce flowtable offload support")
>>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>>> ---
>>> Compile tested-only
>>> ---
>>> drivers/net/ethernet/airoha/airoha_eth.c | 2 ++
>>> 1 file changed, 2 insertions(+)
>>>
>>> diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
>>> index 69e523dd4186..252b32ceb064 100644
>>> --- a/drivers/net/ethernet/airoha/airoha_eth.c
>>> +++ b/drivers/net/ethernet/airoha/airoha_eth.c
>>> @@ -2631,6 +2631,8 @@ static int airoha_probe(struct platform_device *pdev)
>>> }
>>> }
>>> free_netdev(eth->napi_dev);
>>> +
>>> + airoha_ppe_deinit(eth);
>>> platform_set_drvdata(pdev, NULL);
>>>
>>> return err;
>>> --
>>> 2.49.0
>>>
>>
>> Hi Christophe,
>>
>> I agree we are missing a airoha_ppe_deinit() call in the probe error path,
>> but we should move it above after stopping the NAPI since if airoha_hw_init()
>> fails we will undo the work done by airoha_ppe_init(). Something like:
>>
>> diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
>> index 16c7896f931f..37d9678798d1 100644
>> --- a/drivers/net/ethernet/airoha/airoha_eth.c
>> +++ b/drivers/net/ethernet/airoha/airoha_eth.c
>> @@ -2959,6 +2959,7 @@ static int airoha_probe(struct platform_device *pdev)
>> error_napi_stop:
>> for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
>> airoha_qdma_stop_napi(ð->qdma[i]);
>> + airoha_ppe_init(eth);
>> error_hw_cleanup:
>> for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
>> airoha_hw_cleanup(ð->qdma[i]);
>>
>
> Hi Christophe,
>
> any plan to repost this fix?
Hi,
I'll send a v2, but I currently don't have time to look at it.
Will need a few more days.
CJ
>
> Regards,
> Lorenzo
>
>>
>> Agree?
>>
>> Regards,
>> Lorenzo
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] net: airoha: Fix an error handling path in airoha_probe()
2025-04-18 12:28 ` Lorenzo Bianconi
2025-04-29 14:22 ` Lorenzo Bianconi
@ 2025-05-08 14:30 ` Christophe JAILLET
1 sibling, 0 replies; 5+ messages in thread
From: Christophe JAILLET @ 2025-05-08 14:30 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, linux-kernel, kernel-janitors, linux-arm-kernel,
linux-mediatek, netdev
Le 18/04/2025 à 14:28, Lorenzo Bianconi a écrit :
>> If an error occurs after a successful airoha_hw_init() call,
>> airoha_ppe_deinit() needs to be called as already done in the remove
>> function.
>>
>> Fixes: 00a7678310fe ("net: airoha: Introduce flowtable offload support")
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> Compile tested-only
>> ---
>> drivers/net/ethernet/airoha/airoha_eth.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
>> index 69e523dd4186..252b32ceb064 100644
>> --- a/drivers/net/ethernet/airoha/airoha_eth.c
>> +++ b/drivers/net/ethernet/airoha/airoha_eth.c
>> @@ -2631,6 +2631,8 @@ static int airoha_probe(struct platform_device *pdev)
>> }
>> }
>> free_netdev(eth->napi_dev);
>> +
>> + airoha_ppe_deinit(eth);
>> platform_set_drvdata(pdev, NULL);
>>
>> return err;
>> --
>> 2.49.0
>>
>
> Hi Christophe,
>
> I agree we are missing a airoha_ppe_deinit() call in the probe error path,
> but we should move it above after stopping the NAPI since if airoha_hw_init()
> fails we will undo the work done by airoha_ppe_init(). Something like:
Agreed.
I'll send a v2 with as a small series, because of another leak I found
while looking at it.
And while at it, I'll propose a few clean-ups.
CJ
> diff --git a/drivers/net/ethernet/airoha/airoha_eth.c b/drivers/net/ethernet/airoha/airoha_eth.c
> index 16c7896f931f..37d9678798d1 100644
> --- a/drivers/net/ethernet/airoha/airoha_eth.c
> +++ b/drivers/net/ethernet/airoha/airoha_eth.c
> @@ -2959,6 +2959,7 @@ static int airoha_probe(struct platform_device *pdev)
> error_napi_stop:
> for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
> airoha_qdma_stop_napi(ð->qdma[i]);
> + airoha_ppe_init(eth);
> error_hw_cleanup:
> for (i = 0; i < ARRAY_SIZE(eth->qdma); i++)
> airoha_hw_cleanup(ð->qdma[i]);
>
>
> Agree?
>
> Regards,
> Lorenzo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-05-08 15:55 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-18 11:57 [PATCH] net: airoha: Fix an error handling path in airoha_probe() Christophe JAILLET
2025-04-18 12:28 ` Lorenzo Bianconi
2025-04-29 14:22 ` Lorenzo Bianconi
2025-04-29 20:55 ` Christophe JAILLET
2025-05-08 14:30 ` Christophe JAILLET
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).