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

Cristian Marussi cristian.marussi at arm.com
Sun Nov 15 03:05:44 PST 2026


From: Guangshuo Li <liguangshuo at mail.sdu.edu.cn>

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: "Rafael J. Wysocki" <rafael at kernel.org>
Cc: stable at vger.kernel.org
Signed-off-by: Guangshuo Li <liguangshuo at mail.sdu.edu.cn>
Reviewed-by: Cristian Marussi <cristian.marussi at arm.com>
Signed-off-by: Cristian Marussi <cristian.marussi at arm.com>
---
 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 63a956cf8d2b..e2270476a98c 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);
-- 
2.54.0




More information about the linux-arm-kernel mailing list