summaryrefslogtreecommitdiffstats
path: root/drivers/powercap
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2021-02-24 19:30:21 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-03-01 17:43:29 +0100
commitf3c141057976120148ca32d9d030a2256a5ffb7b (patch)
tree5c316e9163b3a3a94d6aa2885e5caeb648283c6c /drivers/powercap
parentLinux 5.12-rc1 (diff)
downloadlinux-f3c141057976120148ca32d9d030a2256a5ffb7b.tar.xz
linux-f3c141057976120148ca32d9d030a2256a5ffb7b.zip
powercap/drivers/dtpm: Fix root node initialization
The root node is not set to NULL when the dtpm root node is removed. Consequently, it is not possible to create a new root as it is already set. Set the root node to NULL when the last node is removed. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/powercap')
-rw-r--r--drivers/powercap/dtpm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/powercap/dtpm.c b/drivers/powercap/dtpm.c
index 5a51cd34a7e8..c2185ec5f887 100644
--- a/drivers/powercap/dtpm.c
+++ b/drivers/powercap/dtpm.c
@@ -207,6 +207,9 @@ int dtpm_release_zone(struct powercap_zone *pcz)
if (dtpm->ops)
dtpm->ops->release(dtpm);
+ if (root == dtpm)
+ root = NULL;
+
kfree(dtpm);
return 0;