netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch net-next] dpll: move xa_erase() call in to match dpll_pin_alloc() error path order
@ 2024-01-30 15:58 Jiri Pirko
  2024-01-30 21:14 ` Vadim Fedorenko
  2024-01-31 21:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Jiri Pirko @ 2024-01-30 15:58 UTC (permalink / raw)
  To: netdev; +Cc: kuba, pabeni, davem, edumazet, vadim.fedorenko,
	arkadiusz.kubalewski

From: Jiri Pirko <jiri@nvidia.com>

This is cosmetics. Move the call of xa_erase() in dpll_pin_put()
so the order of cleanup calls matches the error path of
dpll_pin_alloc().

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
---
 drivers/dpll/dpll_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
index 5152bd1b0daf..61e5c607a72f 100644
--- a/drivers/dpll/dpll_core.c
+++ b/drivers/dpll/dpll_core.c
@@ -560,9 +560,9 @@ void dpll_pin_put(struct dpll_pin *pin)
 {
 	mutex_lock(&dpll_lock);
 	if (refcount_dec_and_test(&pin->refcount)) {
+		xa_erase(&dpll_pin_xa, pin->id);
 		xa_destroy(&pin->dpll_refs);
 		xa_destroy(&pin->parent_refs);
-		xa_erase(&dpll_pin_xa, pin->id);
 		dpll_pin_prop_free(&pin->prop);
 		kfree(pin);
 	}
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [patch net-next] dpll: move xa_erase() call in to match dpll_pin_alloc() error path order
  2024-01-30 15:58 [patch net-next] dpll: move xa_erase() call in to match dpll_pin_alloc() error path order Jiri Pirko
@ 2024-01-30 21:14 ` Vadim Fedorenko
  2024-01-31  8:51   ` Jiri Pirko
  2024-01-31 21:40 ` patchwork-bot+netdevbpf
  1 sibling, 1 reply; 4+ messages in thread
From: Vadim Fedorenko @ 2024-01-30 21:14 UTC (permalink / raw)
  To: Jiri Pirko, netdev; +Cc: kuba, pabeni, davem, edumazet, arkadiusz.kubalewski

On 30/01/2024 15:58, Jiri Pirko wrote:
> From: Jiri Pirko <jiri@nvidia.com>
> 
> This is cosmetics. Move the call of xa_erase() in dpll_pin_put()
> so the order of cleanup calls matches the error path of
> dpll_pin_alloc().

Jiri, remind me please, why do we clean up xarray in error path in the
same order we allocate them?

The patch looks good,

Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>

> 
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
> ---
>   drivers/dpll/dpll_core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
> index 5152bd1b0daf..61e5c607a72f 100644
> --- a/drivers/dpll/dpll_core.c
> +++ b/drivers/dpll/dpll_core.c
> @@ -560,9 +560,9 @@ void dpll_pin_put(struct dpll_pin *pin)
>   {
>   	mutex_lock(&dpll_lock);
>   	if (refcount_dec_and_test(&pin->refcount)) {
> +		xa_erase(&dpll_pin_xa, pin->id);
>   		xa_destroy(&pin->dpll_refs);
>   		xa_destroy(&pin->parent_refs);
> -		xa_erase(&dpll_pin_xa, pin->id);
>   		dpll_pin_prop_free(&pin->prop);
>   		kfree(pin);
>   	}


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch net-next] dpll: move xa_erase() call in to match dpll_pin_alloc() error path order
  2024-01-30 21:14 ` Vadim Fedorenko
@ 2024-01-31  8:51   ` Jiri Pirko
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Pirko @ 2024-01-31  8:51 UTC (permalink / raw)
  To: Vadim Fedorenko
  Cc: netdev, kuba, pabeni, davem, edumazet, arkadiusz.kubalewski

Tue, Jan 30, 2024 at 10:14:49PM CET, vadim.fedorenko@linux.dev wrote:
>On 30/01/2024 15:58, Jiri Pirko wrote:
>> From: Jiri Pirko <jiri@nvidia.com>
>> 
>> This is cosmetics. Move the call of xa_erase() in dpll_pin_put()
>> so the order of cleanup calls matches the error path of
>> dpll_pin_alloc().
>
>Jiri, remind me please, why do we clean up xarray in error path in the
>same order we allocate them?

Yeah, that calls for another cosmetics patch :) Feel free to send it.

>
>The patch looks good,
>
>Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
>
>> 
>> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
>> ---
>>   drivers/dpll/dpll_core.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>> 
>> diff --git a/drivers/dpll/dpll_core.c b/drivers/dpll/dpll_core.c
>> index 5152bd1b0daf..61e5c607a72f 100644
>> --- a/drivers/dpll/dpll_core.c
>> +++ b/drivers/dpll/dpll_core.c
>> @@ -560,9 +560,9 @@ void dpll_pin_put(struct dpll_pin *pin)
>>   {
>>   	mutex_lock(&dpll_lock);
>>   	if (refcount_dec_and_test(&pin->refcount)) {
>> +		xa_erase(&dpll_pin_xa, pin->id);
>>   		xa_destroy(&pin->dpll_refs);
>>   		xa_destroy(&pin->parent_refs);
>> -		xa_erase(&dpll_pin_xa, pin->id);
>>   		dpll_pin_prop_free(&pin->prop);
>>   		kfree(pin);
>>   	}
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch net-next] dpll: move xa_erase() call in to match dpll_pin_alloc() error path order
  2024-01-30 15:58 [patch net-next] dpll: move xa_erase() call in to match dpll_pin_alloc() error path order Jiri Pirko
  2024-01-30 21:14 ` Vadim Fedorenko
@ 2024-01-31 21:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-01-31 21:40 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, kuba, pabeni, davem, edumazet, vadim.fedorenko,
	arkadiusz.kubalewski

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Tue, 30 Jan 2024 16:58:14 +0100 you wrote:
> From: Jiri Pirko <jiri@nvidia.com>
> 
> This is cosmetics. Move the call of xa_erase() in dpll_pin_put()
> so the order of cleanup calls matches the error path of
> dpll_pin_alloc().
> 
> Signed-off-by: Jiri Pirko <jiri@nvidia.com>
> 
> [...]

Here is the summary with links:
  - [net-next] dpll: move xa_erase() call in to match dpll_pin_alloc() error path order
    https://git.kernel.org/netdev/net-next/c/e7f8df0e81bf

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-31 21:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-30 15:58 [patch net-next] dpll: move xa_erase() call in to match dpll_pin_alloc() error path order Jiri Pirko
2024-01-30 21:14 ` Vadim Fedorenko
2024-01-31  8:51   ` Jiri Pirko
2024-01-31 21:40 ` patchwork-bot+netdevbpf

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).