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
This commit is contained in:
Daniel Lezcano 2022-01-30 22:02:05 +01:00
parent 0aea2e4ec2
commit 690de0b401
1 changed files with 2 additions and 2 deletions

View File

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