Skip to contentSkip to conversation

dpll: move xa_erase() call in to match dpll_pin_alloc() error path order

PATCH Applied Jiri Pirko 3 participants 4 messages Jan 30, 2024 – Jan 31, 2024

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author maintainer
#0 lore raw

PATCH 1/1 dpll: move xa_erase() call in to match dpll_pin_alloc() error path order

From: Jiri Pirko <[email protected]>

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

---
 drivers/dpll/dpll_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dpll/dpll_core.c +1 -1
index 5152bd1b0daf..61e5c607a72f 100644
@@ -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);
 	}
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jiri Pirko

From: Jiri Pirko <[email protected]>

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,

Quoted 21 lines
---
  drivers/dpll/dpll_core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dpll/dpll_core.c +1 -1
index 5152bd1b0daf..61e5c607a72f 100644
@@ -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);
  	}
author maintainer
#2 lore raw
Quoted 9 lines · Tue, Jan 30, 2024 at 10:14:49PM CET, [email protected] wrote:
Quoted 5 lines · Jiri Pirko

From: Jiri Pirko <[email protected]>

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.

Quoted 27 lines

The patch looks good,

Quoted 21 lines
---
  drivers/dpll/dpll_core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dpll/dpll_core.c +1 -1
index 5152bd1b0daf..61e5c607a72f 100644
@@ -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);
  	}
#3 lore raw
In reply to Jiri Pirko
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Tue, 30 Jan 2024 16:58:14 +0100 you wrote:

From: Jiri Pirko <[email protected]>

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

[...]

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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html