Skip to contentSkip to conversation

dpll: zl3073x: Remove redundant cleanup in devm_dpll_init()

PATCH Superseded Felix Gu 2 participants 3 messages Feb 23 – Feb 24

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Felix Gu

author
#0 lore raw

PATCH 1/1 dpll: zl3073x: Remove redundant cleanup in devm_dpll_init()

The devm_add_action_or_reset() function already executes the cleanup action on failure before returning an error, so the explicit goto error and subsequent zl3073x_dev_dpll_fini() call causes double cleanup.

Fixes ebb1031c5137 ("dpll: zl3073x: Refactor DPLL initialization")
---
 drivers/dpll/zl3073x/core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/dpll/zl3073x/core.c +1 -3
index 63bd97181b9e..4ad21caec0e8 100644
@@ -982,10 +982,8 @@ zl3073x_devm_dpll_init(struct zl3073x_dev *zldev, u8 num_dplls)
 
 	/* Add devres action to release DPLL related resources */
 	rc = devm_add_action_or_reset(zldev->dev, zl3073x_dev_dpll_fini, zldev);
-	if (rc)
-		goto error;
 
-	return 0;
+	return rc;
 
 error:
 	zl3073x_dev_dpll_fini(zldev);

---
base-commit: d4906ae14a5f136ceb671bb14cedbf13fa560da6
change-id: 20260223-dpll-40c3c8b2ab38

Best regards,

Signature · 1 line
Felix Gu <[email protected]>
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Felix Gu

The devm_add_action_or_reset() function already executes the cleanup action on failure before returning an error, so the explicit goto error and subsequent zl3073x_dev_dpll_fini() call causes double cleanup.

Fixes ebb1031c5137 ("dpll: zl3073x: Refactor DPLL initialization")
---
  drivers/dpll/zl3073x/core.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/dpll/zl3073x/core.c +0 -0
index 63bd97181b9e..4ad21caec0e8 100644

drivers/dpll/zl3073x/core.c zl3073x_devm_dpll_init(struct zl3073x_dev *zldev, u8 num_dplls) · line 986

Quoted 8 lines
drivers/dpll/zl3073x/core.c +1 -3
@@ -982,10 +982,8 @@ zl3073x_devm_dpll_init(struct zl3073x_dev *zldev, u8 num_dplls)
 
  	/* Add devres action to release DPLL related resources */
  	rc = devm_add_action_or_reset(zldev->dev, zl3073x_dev_dpll_fini, zldev);
-	if (rc)
-		goto error;
 
-	return 0;
+	return rc;

Please use:

return devm_add_action_or_reset(...);

Otherwise, LGTM. With this change:

author
#2 lore raw
Quoted 8 lines

Please use:

return devm_add_action_or_reset(...);

Otherwise, LGTM. With this change:

Hi Ivan,

Thanks for the review.
I will update it in V2.

Best regards,
Felix