UPSTREAM: 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>

Link: https://patchwork.kernel.org/project/linux-pm/patch/20210224183022.11846-1-daniel.lezcano@linaro.org/
Bug: 183374898
Change-Id: Idf56d61c16c451b9597d77c8e27372fbaede0ca3
(cherry picked from commit f3c1410579)
Signed-off-by: Ram Chandrasekar <quic_rkumbako@quicinc.com>
This commit is contained in:
Daniel Lezcano 2021-02-24 19:30:21 +01:00 committed by Greg Kroah-Hartman
parent 2d118bc904
commit 11a3ee0438

View File

@ -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;