Skip to contentSkip to conversation

media: mali-c55: Fix clock leak on reset deassert failure

PATCH Superseded David Carlier 3 participants 3 messages Jun 9 – Jul 1

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: mali-c55: Fix clock leak on reset deassert failure

__mali_c55_power_on() enables the clocks before deasserting the resets, but bails out on a deassert failure without disabling them again. Both callers treat a failed power-on as already cleaned up, so the clocks are left enabled.

Disable them on the error path.

Fixes d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver")
---
 drivers/media/platform/arm/mali-c55/mali-c55-core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/platform/arm/mali-c55/mali-c55-core.c +2 -0
index ee4a42674..fb81141d1 100644
@@ -699,6 +699,8 @@ static int __mali_c55_power_on(struct mali_c55 *mali_c55)
 					  mali_c55->resets);
 	if (ret) {
 		dev_err(mali_c55->dev, "failed to deassert resets\n");
+		clk_bulk_disable_unprepare(ARRAY_SIZE(mali_c55->clks),
+					   mali_c55->clks);
 		return ret;
 	}
 
Signature · 1 line
2.53.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Hi David, thanks again!

Quoted 10 lines · David Carlier

__mali_c55_power_on() enables the clocks before deasserting the resets, but bails out on a deassert failure without disabling them again. Both callers treat a failed power-on as already cleaned up, so the clocks are left enabled.

Disable them on the error path.

Fixes d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver")

---

Yep looks good:

Quoted 16 lines
  drivers/media/platform/arm/mali-c55/mali-c55-core.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/media/platform/arm/mali-c55/mali-c55-core.c +2 -0
index ee4a42674..fb81141d1 100644
@@ -699,6 +699,8 @@ static int __mali_c55_power_on(struct mali_c55 *mali_c55)
  					  mali_c55->resets);
  	if (ret) {
  		dev_err(mali_c55->dev, "failed to deassert resets\n");
+		clk_bulk_disable_unprepare(ARRAY_SIZE(mali_c55->clks),
+					   mali_c55->clks);
  		return ret;
  	}
 
maintainer Reviewed-by on v1 1/1
#2 lore raw
In reply to David Carlier

Hi David

Quoted 8 lines · David Carlier

__mali_c55_power_on() enables the clocks before deasserting the resets, but bails out on a deassert failure without disabling them again. Both callers treat a failed power-on as already cleaned up, so the clocks are left enabled.

Disable them on the error path.

Fixes d5f281f3dd29 ("media: mali-c55: Add Mali-C55 ISP driver")

Fixes need to Cc stable

Quoted 1 line

Could you please Cc: [email protected] on a new version so the patch hits the stable list as well ?

Thanks
j

Quoted 21 lines
---
 drivers/media/platform/arm/mali-c55/mali-c55-core.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/platform/arm/mali-c55/mali-c55-core.c +2 -1
index ee4a42674..fb81141d1 100644
@@ -699,6 +699,8 @@ static int __mali_c55_power_on(struct mali_c55 *mali_c55)
 					  mali_c55->resets);
 	if (ret) {
 		dev_err(mali_c55->dev, "failed to deassert resets\n");
+		clk_bulk_disable_unprepare(ARRAY_SIZE(mali_c55->clks),
+					   mali_c55->clks);
 		return ret;
 	}
 
--

2.53.0