diff mbox series

[net-next] dpll: move xa_erase() call in to match dpll_pin_alloc() error path order

Message ID 20240130155814.268622-1-jiri@resnulli.us (mailing list archive)
State Accepted
Commit e7f8df0e81bf73ab6dc6ac1dc01273fa06564119
Delegated to: Netdev Maintainers
Headers show
Series [net-next] dpll: move xa_erase() call in to match dpll_pin_alloc() error path order | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1050 this patch: 1050
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 0 of 0 maintainers
netdev/build_clang success Errors and warnings before: 1066 this patch: 1066
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1067 this patch: 1067
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 10 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-01-31--06-00 (tests: 715)

Commit Message

Jiri Pirko Jan. 30, 2024, 3:58 p.m. UTC
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(-)

Comments

Vadim Fedorenko Jan. 30, 2024, 9:14 p.m. UTC | #1
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);
>   	}
Jiri Pirko Jan. 31, 2024, 8:51 a.m. UTC | #2
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);
>>   	}
>
patchwork-bot+netdevbpf@kernel.org Jan. 31, 2024, 9:40 p.m. UTC | #3
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!
diff mbox series

Patch

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);
 	}