diff mbox series

[RESEND,v2,1/2] pmdomain: ti-sci: Add missing of_node_put() for args.np

Message ID 20240926012551.31712-2-zhangzekun11@huawei.com (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series Some cleanup and fix the missing of_node_put() | expand

Commit Message

zhangzekun (A) Sept. 26, 2024, 1:25 a.m. UTC
of_parse_phandle_with_args() need to call of_node_put() to decerement
the refcount of args.np. Adding backing the missing of_node_put().

Fixes: efa5c01cd7ee ("soc: ti: ti_sci_pm_domains: switch to use multiple genpds instead of one")
Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
---
v2: Add missing brackets.

 drivers/pmdomain/ti/ti_sci_pm_domains.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Dhruva Gole Sept. 26, 2024, 9:30 a.m. UTC | #1
On Sep 26, 2024 at 09:25:50 +0800, Zhang Zekun wrote:
> of_parse_phandle_with_args() need to call of_node_put() to decerement

s/need/needs
s/decerement/decrement ?

> the refcount of args.np. Adding backing the missing of_node_put().

Add back* the missing...

Also, Just curious on why you're saying "Adding back", was it was there before but someone
removed it?

> 
> Fixes: efa5c01cd7ee ("soc: ti: ti_sci_pm_domains: switch to use multiple genpds instead of one")
> Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
> ---
> v2: Add missing brackets.

where? Please specify links to previous revision patches.
Here, I have no real context of what's changes in V2 and why :)

> 
>  drivers/pmdomain/ti/ti_sci_pm_domains.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/pmdomain/ti/ti_sci_pm_domains.c b/drivers/pmdomain/ti/ti_sci_pm_domains.c
> index 1510d5ddae3d..0df3eb7ff09a 100644
> --- a/drivers/pmdomain/ti/ti_sci_pm_domains.c
> +++ b/drivers/pmdomain/ti/ti_sci_pm_domains.c
> @@ -161,6 +161,7 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev)
>  				break;
>  
>  			if (args.args_count >= 1 && args.np == dev->of_node) {
> +				of_node_put(args.np);
>  				if (args.args[0] > max_id) {
>  					max_id = args.args[0];
>  				} else {
> @@ -192,7 +193,10 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev)
>  				pm_genpd_init(&pd->pd, NULL, true);
>  
>  				list_add(&pd->node, &pd_provider->pd_list);
> +			} else {
> +				of_node_put(args.np);
>  			}

No need of else, I feel you just need to use of_node_put once, and it
can be done after the whole if block, no?

> +
>  			index++;
>  		}
>  	}
> -- 
> 2.17.1
> 
>
zhangzekun (A) Oct. 14, 2024, 2:22 a.m. UTC | #2
在 2024/9/26 17:30, Dhruva Gole 写道:
> On Sep 26, 2024 at 09:25:50 +0800, Zhang Zekun wrote:
>> of_parse_phandle_with_args() need to call of_node_put() to decerement
> 
> s/need/needs
> s/decerement/decrement ?
> 
>> the refcount of args.np. Adding backing the missing of_node_put().
> 
> Add back* the missing...
> 
> Also, Just curious on why you're saying "Adding back", was it was there before but someone
> removed it?
> 
Hi,Dhruva,

Sorry for the delay, I have missed this question before.
There is no of_node_put() before and no one has removed it. It is newly 
added in this patch.

Best Regards,
Zekun

>>
>> Fixes: efa5c01cd7ee ("soc: ti: ti_sci_pm_domains: switch to use multiple genpds instead of one")
>> Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
>> ---
>> v2: Add missing brackets.
> 
> where? Please specify links to previous revision patches.
> Here, I have no real context of what's changes in V2 and why :)
> 
>>
>>   drivers/pmdomain/ti/ti_sci_pm_domains.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/pmdomain/ti/ti_sci_pm_domains.c b/drivers/pmdomain/ti/ti_sci_pm_domains.c
>> index 1510d5ddae3d..0df3eb7ff09a 100644
>> --- a/drivers/pmdomain/ti/ti_sci_pm_domains.c
>> +++ b/drivers/pmdomain/ti/ti_sci_pm_domains.c
>> @@ -161,6 +161,7 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev)
>>   				break;
>>   
>>   			if (args.args_count >= 1 && args.np == dev->of_node) {
>> +				of_node_put(args.np);
>>   				if (args.args[0] > max_id) {
>>   					max_id = args.args[0];
>>   				} else {
>> @@ -192,7 +193,10 @@ static int ti_sci_pm_domain_probe(struct platform_device *pdev)
>>   				pm_genpd_init(&pd->pd, NULL, true);
>>   
>>   				list_add(&pd->node, &pd_provider->pd_list);
>> +			} else {
>> +				of_node_put(args.np);
>>   			}
> 
> No need of else, I feel you just need to use of_node_put once, and it
> can be done after the whole if block, no?
> 
>> +
>>   			index++;
>>   		}
>>   	}
>> -- 
>> 2.17.1
>>
>>
>
diff mbox series

Patch

diff --git a/drivers/pmdomain/ti/ti_sci_pm_domains.c b/drivers/pmdomain/ti/ti_sci_pm_domains.c
index 1510d5ddae3d..0df3eb7ff09a 100644
--- a/drivers/pmdomain/ti/ti_sci_pm_domains.c
+++ b/drivers/pmdomain/ti/ti_sci_pm_domains.c
@@ -161,6 +161,7 @@  static int ti_sci_pm_domain_probe(struct platform_device *pdev)
 				break;
 
 			if (args.args_count >= 1 && args.np == dev->of_node) {
+				of_node_put(args.np);
 				if (args.args[0] > max_id) {
 					max_id = args.args[0];
 				} else {
@@ -192,7 +193,10 @@  static int ti_sci_pm_domain_probe(struct platform_device *pdev)
 				pm_genpd_init(&pd->pd, NULL, true);
 
 				list_add(&pd->node, &pd_provider->pd_list);
+			} else {
+				of_node_put(args.np);
 			}
+
 			index++;
 		}
 	}