From: Daniel Lezcano Date: Sun, 30 Jan 2022 21:02:07 +0000 (+0100) Subject: powercap/dtpm: Move the 'root' reset place X-Git-Tag: v5.18-rc1~203^2~1^2~2^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4712a236db409d5ee5dccb8c7e57fe54d7d3ec66;p=thirdparty%2Fkernel%2Flinux.git powercap/dtpm: Move the 'root' reset place The 'root' node is checked everytime a dtpm node is destroyed. When we reach the end of the hierarchy destruction function, we can unconditionnaly set the 'root' node to NULL again. Signed-off-by: Daniel Lezcano Reviewed-by: Ulf Hansson Link: https://lore.kernel.org/r/20220130210210.549877-5-daniel.lezcano@linaro.org --- diff --git a/drivers/powercap/dtpm.c b/drivers/powercap/dtpm.c index d9d74f9811186..ec931a06d90ae 100644 --- a/drivers/powercap/dtpm.c +++ b/drivers/powercap/dtpm.c @@ -184,9 +184,6 @@ int dtpm_release_zone(struct powercap_zone *pcz) else kfree(dtpm); - if (root == dtpm) - root = NULL; - return 0; } @@ -656,6 +653,8 @@ void dtpm_destroy_hierarchy(void) pct = NULL; + root = NULL; + out_unlock: mutex_unlock(&dtpm_lock); }