diff mbox series

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

Message ID 20240822130055.50113-2-zhangzekun11@huawei.com
State New
Headers show
Series Some cleanup and fix the missing of_node_put() | expand

Commit Message

Zhang Zekun Aug. 22, 2024, 1 p.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>
---
 drivers/pmdomain/ti/ti_sci_pm_domains.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Ulf Hansson Sept. 13, 2024, 10:05 a.m. UTC | #1
On Thu, 22 Aug 2024 at 15:14, Zhang Zekun <zhangzekun11@huawei.com> wrote:
>
> 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>
> ---
>  drivers/pmdomain/ti/ti_sci_pm_domains.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pmdomain/ti/ti_sci_pm_domains.c b/drivers/pmdomain/ti/ti_sci_pm_domains.c
> index 1510d5ddae3d..2b5c26713958 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,8 @@ 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

Usually we have brackets here too, as it was needed for the first if-clause.

> +                               of_node_put(args.np);
>                         index++;
>                 }
>         }
> --
> 2.17.1
>

Otherwise this looks good to me!

Kind regards
Uffe
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..2b5c26713958 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,8 @@  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++;
 		}
 	}