linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pmdomain: rockchip: Simplify dropping OF node reference
@ 2024-08-25 18:31 Krzysztof Kozlowski
  2024-08-25 18:52 ` Heiko Stübner
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Krzysztof Kozlowski @ 2024-08-25 18:31 UTC (permalink / raw)
  To: Ulf Hansson, Heiko Stuebner, linux-pm, linux-arm-kernel,
	linux-rockchip, linux-kernel
  Cc: Krzysztof Kozlowski

Drop OF node reference immediately after using it in
syscon_node_to_regmap(), which is both simpler and typical/expected
code pattern.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 drivers/pmdomain/rockchip/pm-domains.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
index 64b4d7120d83..5ee7efbd2ef8 100644
--- a/drivers/pmdomain/rockchip/pm-domains.c
+++ b/drivers/pmdomain/rockchip/pm-domains.c
@@ -716,12 +716,11 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
 				goto err_unprepare_clocks;
 			}
 			pd->qos_regmap[j] = syscon_node_to_regmap(qos_node);
+			of_node_put(qos_node);
 			if (IS_ERR(pd->qos_regmap[j])) {
 				error = -ENODEV;
-				of_node_put(qos_node);
 				goto err_unprepare_clocks;
 			}
-			of_node_put(qos_node);
 		}
 	}
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pmdomain: rockchip: Simplify dropping OF node reference
  2024-08-25 18:31 [PATCH] pmdomain: rockchip: Simplify dropping OF node reference Krzysztof Kozlowski
@ 2024-08-25 18:52 ` Heiko Stübner
  2024-09-13 12:01 ` Ulf Hansson
  2024-09-13 13:16 ` Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: Heiko Stübner @ 2024-08-25 18:52 UTC (permalink / raw)
  To: Ulf Hansson, linux-pm, linux-arm-kernel, linux-rockchip,
	linux-kernel, Krzysztof Kozlowski
  Cc: Krzysztof Kozlowski

Am Sonntag, 25. August 2024, 20:31:16 CEST schrieb Krzysztof Kozlowski:
> Drop OF node reference immediately after using it in
> syscon_node_to_regmap(), which is both simpler and typical/expected
> code pattern.
> 
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Reviewed-by: Heiko Stuebner <heiko@sntech.de>



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pmdomain: rockchip: Simplify dropping OF node reference
  2024-08-25 18:31 [PATCH] pmdomain: rockchip: Simplify dropping OF node reference Krzysztof Kozlowski
  2024-08-25 18:52 ` Heiko Stübner
@ 2024-09-13 12:01 ` Ulf Hansson
  2024-09-13 13:16 ` Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2024-09-13 12:01 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Heiko Stuebner, linux-pm, linux-arm-kernel, linux-rockchip,
	linux-kernel

On Sun, 25 Aug 2024 at 20:31, Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:
>
> Drop OF node reference immediately after using it in
> syscon_node_to_regmap(), which is both simpler and typical/expected
> code pattern.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/pmdomain/rockchip/pm-domains.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/pmdomain/rockchip/pm-domains.c b/drivers/pmdomain/rockchip/pm-domains.c
> index 64b4d7120d83..5ee7efbd2ef8 100644
> --- a/drivers/pmdomain/rockchip/pm-domains.c
> +++ b/drivers/pmdomain/rockchip/pm-domains.c
> @@ -716,12 +716,11 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
>                                 goto err_unprepare_clocks;
>                         }
>                         pd->qos_regmap[j] = syscon_node_to_regmap(qos_node);
> +                       of_node_put(qos_node);
>                         if (IS_ERR(pd->qos_regmap[j])) {
>                                 error = -ENODEV;
> -                               of_node_put(qos_node);
>                                 goto err_unprepare_clocks;
>                         }
> -                       of_node_put(qos_node);
>                 }
>         }
>
> --
> 2.43.0
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pmdomain: rockchip: Simplify dropping OF node reference
  2024-08-25 18:31 [PATCH] pmdomain: rockchip: Simplify dropping OF node reference Krzysztof Kozlowski
  2024-08-25 18:52 ` Heiko Stübner
  2024-09-13 12:01 ` Ulf Hansson
@ 2024-09-13 13:16 ` Markus Elfring
  2 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2024-09-13 13:16 UTC (permalink / raw)
  To: Krzysztof Kozlowski, linux-pm, kernel-janitors, linux-rockchip,
	linux-arm-kernel, cocci, Heiko Stübner, Ulf Hansson
  Cc: LKML

> Drop OF node reference immediately after using it in
> syscon_node_to_regmap(), which is both simpler and typical/expected
> code pattern.

Dear Krzysztof,

I noticed also this contribution.
I found it easy to convert it also into the following small script variant
for the semantic patch language (Coccinelle software).


@adjustment@
expression e, x;
@@
+of_node_put(e);
 if (...)
 {
 <+... when != e = x
-   of_node_put(e);
 ...+>
 }
-of_node_put(e);


58 patches were accordingly generated for source files of the software “Linux next-20240913”.
How would we like to tackle remaining update candidates according to similar transformation patterns?

Regards,
Markus

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-09-13 13:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-25 18:31 [PATCH] pmdomain: rockchip: Simplify dropping OF node reference Krzysztof Kozlowski
2024-08-25 18:52 ` Heiko Stübner
2024-09-13 12:01 ` Ulf Hansson
2024-09-13 13:16 ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).