diff mbox series

[1/2] powercap/drivers/dtpm: Fix root node initialization

Message ID 20210224183022.11846-1-daniel.lezcano@linaro.org
State Accepted
Commit f3c141057976120148ca32d9d030a2256a5ffb7b
Headers show
Series [1/2] powercap/drivers/dtpm: Fix root node initialization | expand

Commit Message

Daniel Lezcano Feb. 24, 2021, 6:30 p.m. UTC
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>

---
 drivers/powercap/dtpm.c | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.17.1

Comments

Rafael J. Wysocki March 1, 2021, 4:45 p.m. UTC | #1
On Wed, Feb 24, 2021 at 7:30 PM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>

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

> ---

>  drivers/powercap/dtpm.c | 3 +++

>  1 file changed, 3 insertions(+)

>

> diff --git a/drivers/powercap/dtpm.c b/drivers/powercap/dtpm.c

> index 5a51cd34a7e8..c2185ec5f887 100644

> --- a/drivers/powercap/dtpm.c

> +++ b/drivers/powercap/dtpm.c

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

> --


Applied along with the [2/2[ as 5.12-rc material, thanks!
Daniel Lezcano March 1, 2021, 6:15 p.m. UTC | #2
On 01/03/2021 17:45, Rafael J. Wysocki wrote:
> On Wed, Feb 24, 2021 at 7:30 PM Daniel Lezcano

> <daniel.lezcano@linaro.org> wrote:

>>

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

>> ---

>>  drivers/powercap/dtpm.c | 3 +++

>>  1 file changed, 3 insertions(+)

>>

>> diff --git a/drivers/powercap/dtpm.c b/drivers/powercap/dtpm.c

>> index 5a51cd34a7e8..c2185ec5f887 100644

>> --- a/drivers/powercap/dtpm.c

>> +++ b/drivers/powercap/dtpm.c

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

>> --

> 

> Applied along with the [2/2[ as 5.12-rc material, thanks!


Thanks


-- 
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
diff mbox series

Patch

diff --git a/drivers/powercap/dtpm.c b/drivers/powercap/dtpm.c
index 5a51cd34a7e8..c2185ec5f887 100644
--- a/drivers/powercap/dtpm.c
+++ b/drivers/powercap/dtpm.c
@@ -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;