Skip to content

Commit 690de0b

Browse files
committed
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
1 parent 0aea2e4 commit 690de0b

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/powercap/dtpm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,12 +181,12 @@ int dtpm_release_zone(struct powercap_zone *pcz)
181181

182182
if (dtpm->ops)
183183
dtpm->ops->release(dtpm);
184+
else
185+
kfree(dtpm);
184186

185187
if (root == dtpm)
186188
root = NULL;
187189

188-
kfree(dtpm);
189-
190190
return 0;
191191
}
192192

0 commit comments

Comments
 (0)