aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/powercap
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2022-01-30 22:02:05 +0100
committerDaniel Lezcano <daniel.lezcano@linaro.org>2022-02-23 19:45:33 +0100
commit690de0b4013f6f35bc9fced12746b9f396c471ae (patch)
tree951c076099da2bb5957fdce67b35f54d89400cb2 /drivers/powercap
parentpowercap/dtpm_cpu: Reset per_cpu variable in the release function (diff)
downloadwireguard-linux-690de0b4013f6f35bc9fced12746b9f396c471ae.tar.xz
wireguard-linux-690de0b4013f6f35bc9fced12746b9f396c471ae.zip
powercap/dtpm: Fixup kfree for virtual node
When the node is virtual there is no release function associated which can free the memory. Free the memory when no 'ops' exists. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20220130210210.549877-3-daniel.lezcano@linaro.org
Diffstat (limited to 'drivers/powercap')
-rw-r--r--drivers/powercap/dtpm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/powercap/dtpm.c b/drivers/powercap/dtpm.c
index 0b0121c37a1b..7bddd25a6767 100644
--- a/drivers/powercap/dtpm.c
+++ b/drivers/powercap/dtpm.c
@@ -181,12 +181,12 @@ int dtpm_release_zone(struct powercap_zone *pcz)
if (dtpm->ops)
dtpm->ops->release(dtpm);
+ else
+ kfree(dtpm);
if (root == dtpm)
root = NULL;
- kfree(dtpm);
-
return 0;
}