mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] clk: Use of_property_present()
@ 2024-07-31 19:12 Rob Herring (Arm)
  2024-07-31 19:59 ` Linus Walleij
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Rob Herring (Arm) @ 2024-07-31 19:12 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Geert Uytterhoeven, Linus Walleij
  Cc: linux-clk, linux-kernel, linux-renesas-soc, linux-arm-kernel

Use of_property_present() to test for property presence rather than
of_(find|get)_property(). This is part of a larger effort to remove
callers of of_find_property() and similar functions.
of_(find|get)_property() leak the DT struct property and data pointers
which is a problem for dynamically allocated nodes which may be freed.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
 drivers/clk/clk.c                 | 2 +-
 drivers/clk/renesas/clk-mstp.c    | 2 +-
 drivers/clk/versatile/clk-sp810.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 285ed1ad8a37..7264cf6165ce 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -5232,7 +5232,7 @@ static int of_parse_clkspec(const struct device_node *np, int index,
 		 * clocks.
 		 */
 		np = np->parent;
-		if (np && !of_get_property(np, "clock-ranges", NULL))
+		if (np && !of_property_present(np, "clock-ranges"))
 			break;
 		index = 0;
 	}
diff --git a/drivers/clk/renesas/clk-mstp.c b/drivers/clk/renesas/clk-mstp.c
index 5304c977562f..5bc473c2adb3 100644
--- a/drivers/clk/renesas/clk-mstp.c
+++ b/drivers/clk/renesas/clk-mstp.c
@@ -207,7 +207,7 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
 	for (i = 0; i < MSTP_MAX_CLOCKS; ++i)
 		clks[i] = ERR_PTR(-ENOENT);
 
-	if (of_find_property(np, "clock-indices", &i))
+	if (of_property_present(np, "clock-indices"))
 		idxname = "clock-indices";
 	else
 		idxname = "renesas,clock-indices";
diff --git a/drivers/clk/versatile/clk-sp810.c b/drivers/clk/versatile/clk-sp810.c
index 45adac1b4630..033d4f78edc8 100644
--- a/drivers/clk/versatile/clk-sp810.c
+++ b/drivers/clk/versatile/clk-sp810.c
@@ -110,7 +110,7 @@ static void __init clk_sp810_of_setup(struct device_node *node)
 	init.parent_names = parent_names;
 	init.num_parents = num;
 
-	deprecated = !of_find_property(node, "assigned-clock-parents", NULL);
+	deprecated = !of_property_present(node, "assigned-clock-parents");
 
 	for (i = 0; i < ARRAY_SIZE(sp810->timerclken); i++) {
 		snprintf(name, sizeof(name), "sp810_%d_%d", instance, i);
-- 
2.43.0


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

* Re: [PATCH] clk: Use of_property_present()
  2024-07-31 19:12 [PATCH] clk: Use of_property_present() Rob Herring (Arm)
@ 2024-07-31 19:59 ` Linus Walleij
  2024-08-01  7:15 ` Geert Uytterhoeven
  2024-08-02 23:54 ` Stephen Boyd
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2024-07-31 19:59 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Michael Turquette, Stephen Boyd, Geert Uytterhoeven, linux-clk,
	linux-kernel, linux-renesas-soc, linux-arm-kernel

On Wed, Jul 31, 2024 at 9:13 PM Rob Herring (Arm) <robh@kernel.org> wrote:

> Use of_property_present() to test for property presence rather than
> of_(find|get)_property(). This is part of a larger effort to remove
> callers of of_find_property() and similar functions.
> of_(find|get)_property() leak the DT struct property and data pointers
> which is a problem for dynamically allocated nodes which may be freed.
>
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH] clk: Use of_property_present()
  2024-07-31 19:12 [PATCH] clk: Use of_property_present() Rob Herring (Arm)
  2024-07-31 19:59 ` Linus Walleij
@ 2024-08-01  7:15 ` Geert Uytterhoeven
  2024-08-02 23:54 ` Stephen Boyd
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2024-08-01  7:15 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Michael Turquette, Stephen Boyd, Linus Walleij, linux-clk,
	linux-kernel, linux-renesas-soc, linux-arm-kernel

On Wed, Jul 31, 2024 at 9:13 PM Rob Herring (Arm) <robh@kernel.org> wrote:
> Use of_property_present() to test for property presence rather than
> of_(find|get)_property(). This is part of a larger effort to remove
> callers of of_find_property() and similar functions.
> of_(find|get)_property() leak the DT struct property and data pointers
> which is a problem for dynamically allocated nodes which may be freed.
>
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

>  drivers/clk/renesas/clk-mstp.c    | 2 +-

Acked-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] clk: Use of_property_present()
  2024-07-31 19:12 [PATCH] clk: Use of_property_present() Rob Herring (Arm)
  2024-07-31 19:59 ` Linus Walleij
  2024-08-01  7:15 ` Geert Uytterhoeven
@ 2024-08-02 23:54 ` Stephen Boyd
  2 siblings, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2024-08-02 23:54 UTC (permalink / raw)
  To: Geert Uytterhoeven, Linus Walleij, Michael Turquette, Rob Herring
  Cc: linux-clk, linux-kernel, linux-renesas-soc, linux-arm-kernel

Quoting Rob Herring (Arm) (2024-07-31 12:12:42)
> Use of_property_present() to test for property presence rather than
> of_(find|get)_property(). This is part of a larger effort to remove
> callers of of_find_property() and similar functions.
> of_(find|get)_property() leak the DT struct property and data pointers
> which is a problem for dynamically allocated nodes which may be freed.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
> ---

Applied to clk-next

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

end of thread, other threads:[~2024-08-02 23:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-31 19:12 [PATCH] clk: Use of_property_present() Rob Herring (Arm)
2024-07-31 19:59 ` Linus Walleij
2024-08-01  7:15 ` Geert Uytterhoeven
2024-08-02 23:54 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®