[PATCH] cpuidle: Fix reference count on CPU node

Miquel Sabaté Solà posted 1 patch 2 months, 1 week ago
drivers/cpuidle/cpuidle-qcom-spm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
[PATCH] cpuidle: Fix reference count on CPU node
Posted by Miquel Sabaté Solà 2 months, 1 week ago
For the qcom-spm driver, an early return was not calling the proper
of_node_put call for a previously acquired device node.

Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
---
 drivers/cpuidle/cpuidle-qcom-spm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/cpuidle/cpuidle-qcom-spm.c b/drivers/cpuidle/cpuidle-qcom-spm.c
index 1fc9968eae19..d3608f47d02b 100644
--- a/drivers/cpuidle/cpuidle-qcom-spm.c
+++ b/drivers/cpuidle/cpuidle-qcom-spm.c
@@ -96,8 +96,10 @@ static int spm_cpuidle_register(struct device *cpuidle_dev, int cpu)
 		return -ENODEV;
 
 	saw_node = of_parse_phandle(cpu_node, "qcom,saw", 0);
-	if (!saw_node)
+	if (!saw_node) {
+		of_node_put(cpu_node);
 		return -ENODEV;
+	}
 
 	pdev = of_find_device_by_node(saw_node);
 	of_node_put(saw_node);
-- 
2.46.0

Re: [PATCH] cpuidle: Fix reference count on CPU node
Posted by Dmitry Baryshkov 1 month ago
On Tue, Sep 17, 2024 at 11:13:25PM +0200, Miquel Sabaté Solà wrote:
> For the qcom-spm driver, an early return was not calling the proper
> of_node_put call for a previously acquired device node.
> 
> Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
> ---
>  drivers/cpuidle/cpuidle-qcom-spm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

-- 
With best wishes
Dmitry
Re: [PATCH] cpuidle: Fix reference count on CPU node
Posted by Miquel Sabaté Solà 1 month, 4 weeks ago
On dt., de set. 17 2024, Miquel Sabaté Solà wrote:

> For the qcom-spm driver, an early return was not calling the proper
> of_node_put call for a previously acquired device node.
>
> Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
> ---
>  drivers/cpuidle/cpuidle-qcom-spm.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/cpuidle/cpuidle-qcom-spm.c b/drivers/cpuidle/cpuidle-qcom-spm.c
> index 1fc9968eae19..d3608f47d02b 100644
> --- a/drivers/cpuidle/cpuidle-qcom-spm.c
> +++ b/drivers/cpuidle/cpuidle-qcom-spm.c
> @@ -96,8 +96,10 @@ static int spm_cpuidle_register(struct device *cpuidle_dev, int cpu)
>  		return -ENODEV;
>  
>  	saw_node = of_parse_phandle(cpu_node, "qcom,saw", 0);
> -	if (!saw_node)
> +	if (!saw_node) {
> +		of_node_put(cpu_node);
>  		return -ENODEV;
> +	}
>  
>  	pdev = of_find_device_by_node(saw_node);
>  	of_node_put(saw_node);

Gently ping for a fix in the same spirit as [1].

Could you take a look whenever you have some time?

Thanks!
Miquel

[1] https://lore.kernel.org/all/20240917134246.584026-1-mikisabate@gmail.com/
Re: [PATCH] cpuidle: Fix reference count on CPU node
Posted by Miquel Sabaté Solà 1 month, 1 week ago
On dt., d’oct. 01 2024, Miquel Sabaté Solà wrote:

> On dt., de set. 17 2024, Miquel Sabaté Solà wrote:
>
>> For the qcom-spm driver, an early return was not calling the proper
>> of_node_put call for a previously acquired device node.
>>
>> Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
>> ---
>>  drivers/cpuidle/cpuidle-qcom-spm.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/cpuidle/cpuidle-qcom-spm.c b/drivers/cpuidle/cpuidle-qcom-spm.c
>> index 1fc9968eae19..d3608f47d02b 100644
>> --- a/drivers/cpuidle/cpuidle-qcom-spm.c
>> +++ b/drivers/cpuidle/cpuidle-qcom-spm.c
>> @@ -96,8 +96,10 @@ static int spm_cpuidle_register(struct device *cpuidle_dev, int cpu)
>>  		return -ENODEV;
>>  
>>  	saw_node = of_parse_phandle(cpu_node, "qcom,saw", 0);
>> -	if (!saw_node)
>> +	if (!saw_node) {
>> +		of_node_put(cpu_node);
>>  		return -ENODEV;
>> +	}
>>  
>>  	pdev = of_find_device_by_node(saw_node);
>>  	of_node_put(saw_node);
>
> Gently ping for a fix in the same spirit as [1].
>
> Could you take a look whenever you have some time?
>
> Thanks!
> Miquel
>
> [1] https://lore.kernel.org/all/20240917134246.584026-1-mikisabate@gmail.com/

Gently ping. Could someone take a look at this fix?

Thanks,
Miquel
Re: [PATCH] cpuidle: Fix reference count on CPU node
Posted by Miquel Sabaté Solà 2 weeks, 1 day ago
On dt., d’oct. 22 2024, Miquel Sabaté Solà wrote:

> On dt., d’oct. 01 2024, Miquel Sabaté Solà wrote:
>
>> On dt., de set. 17 2024, Miquel Sabaté Solà wrote:
>>
>>> For the qcom-spm driver, an early return was not calling the proper
>>> of_node_put call for a previously acquired device node.
>>>
>>> Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
>>> ---
>>>  drivers/cpuidle/cpuidle-qcom-spm.c | 4 +++-
>>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/cpuidle/cpuidle-qcom-spm.c b/drivers/cpuidle/cpuidle-qcom-spm.c
>>> index 1fc9968eae19..d3608f47d02b 100644
>>> --- a/drivers/cpuidle/cpuidle-qcom-spm.c
>>> +++ b/drivers/cpuidle/cpuidle-qcom-spm.c
>>> @@ -96,8 +96,10 @@ static int spm_cpuidle_register(struct device *cpuidle_dev, int cpu)
>>>  		return -ENODEV;
>>>
>>>  	saw_node = of_parse_phandle(cpu_node, "qcom,saw", 0);
>>> -	if (!saw_node)
>>> +	if (!saw_node) {
>>> +		of_node_put(cpu_node);
>>>  		return -ENODEV;
>>> +	}
>>>
>>>  	pdev = of_find_device_by_node(saw_node);
>>>  	of_node_put(saw_node);
>>
>> Gently ping for a fix in the same spirit as [1].
>>
>> Could you take a look whenever you have some time?
>>
>> Thanks!
>> Miquel
>>
>> [1] https://lore.kernel.org/all/20240917134246.584026-1-mikisabate@gmail.com/
>
> Gently ping. Could someone take a look at this fix?
>
> Thanks,
> Miquel

Hello,

This is most probably too late for 6.12, but might this be included for
6.13?

Could you take a look?

Thanks,
Miquel