Skip to content

Commit

Permalink
powercap/drivers/dtpm: Fix root node initialization
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
  • Loading branch information
dlezcano authored and rafaeljw committed Mar 1, 2021
1 parent fe07bfd commit f3c1410
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/powercap/dtpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f3c1410

Please sign in to comment.