[PATCH] powercap: arm_scmi: Fix potential stale zones after a skipped leaf

Guangshuo Li liguangshuo at mail.sdu.edu.cn
Fri Nov 13 06:09:35 PST 2026


scmi_zones_register() skips leaf zones that cannot be registered, but
returns the last leaf error when that leaf ends the traversal. Probe
then fails without unregistering the successfully registered zones,
whose private data is device-managed.

Return success after completing the traversal. Keep the existing error
return and full rollback for a failed non-leaf zone.

This issue was found by our static analysis tool under development.

Fixes: 3e767d6850f8 ("powercap: arm_scmi: Remove recursion while parsing zones")
Cc: stable at vger.kernel.org
Signed-off-by: Guangshuo Li <liguangshuo at mail.sdu.edu.cn>
---
 drivers/powercap/arm_scmi_powercap.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/powercap/arm_scmi_powercap.c b/drivers/powercap/arm_scmi_powercap.c
index ab66e9a3b1e2..edc1e2823ec3 100644
--- a/drivers/powercap/arm_scmi_powercap.c
+++ b/drivers/powercap/arm_scmi_powercap.c
@@ -407,6 +407,7 @@ static int scmi_zones_register(struct device *dev,
 							       node);
 		}
 	}
+	ret = 0;
 
 out:
 	kfree(zones_stack);

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4



More information about the linux-arm-kernel mailing list