Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: Use of_property_present()

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>
Link: https://lore.kernel.org/r/20240731191312.1710417-4-robh@kernel.org
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> # clk-mstp.c
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Rob Herring (Arm) and committed by
Stephen Boyd
66b06523 9d6a5304

+3 -3
+1 -1
drivers/clk/clk.c
··· 5232 5232 * clocks. 5233 5233 */ 5234 5234 np = np->parent; 5235 - if (np && !of_get_property(np, "clock-ranges", NULL)) 5235 + if (np && !of_property_present(np, "clock-ranges")) 5236 5236 break; 5237 5237 index = 0; 5238 5238 }
+1 -1
drivers/clk/renesas/clk-mstp.c
··· 207 207 for (i = 0; i < MSTP_MAX_CLOCKS; ++i) 208 208 clks[i] = ERR_PTR(-ENOENT); 209 209 210 - if (of_find_property(np, "clock-indices", &i)) 210 + if (of_property_present(np, "clock-indices")) 211 211 idxname = "clock-indices"; 212 212 else 213 213 idxname = "renesas,clock-indices";
+1 -1
drivers/clk/versatile/clk-sp810.c
··· 110 110 init.parent_names = parent_names; 111 111 init.num_parents = num; 112 112 113 - deprecated = !of_find_property(node, "assigned-clock-parents", NULL); 113 + deprecated = !of_property_present(node, "assigned-clock-parents"); 114 114 115 115 for (i = 0; i < ARRAY_SIZE(sp810->timerclken); i++) { 116 116 snprintf(name, sizeof(name), "sp810_%d_%d", instance, i);