Skip to content

Commit 66b0652

Browse files
robherringbebarino
authored andcommitted
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) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Linus Walleij <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> # clk-mstp.c Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Stephen Boyd <[email protected]>
1 parent 9d6a530 commit 66b0652

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

drivers/clk/clk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5232,7 +5232,7 @@ static int of_parse_clkspec(const struct device_node *np, int index,
52325232
* clocks.
52335233
*/
52345234
np = np->parent;
5235-
if (np && !of_get_property(np, "clock-ranges", NULL))
5235+
if (np && !of_property_present(np, "clock-ranges"))
52365236
break;
52375237
index = 0;
52385238
}

drivers/clk/renesas/clk-mstp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ static void __init cpg_mstp_clocks_init(struct device_node *np)
207207
for (i = 0; i < MSTP_MAX_CLOCKS; ++i)
208208
clks[i] = ERR_PTR(-ENOENT);
209209

210-
if (of_find_property(np, "clock-indices", &i))
210+
if (of_property_present(np, "clock-indices"))
211211
idxname = "clock-indices";
212212
else
213213
idxname = "renesas,clock-indices";

drivers/clk/versatile/clk-sp810.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ static void __init clk_sp810_of_setup(struct device_node *node)
110110
init.parent_names = parent_names;
111111
init.num_parents = num;
112112

113-
deprecated = !of_find_property(node, "assigned-clock-parents", NULL);
113+
deprecated = !of_property_present(node, "assigned-clock-parents");
114114

115115
for (i = 0; i < ARRAY_SIZE(sp810->timerclken); i++) {
116116
snprintf(name, sizeof(name), "sp810_%d_%d", instance, i);

0 commit comments

Comments
 (0)