]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
clk: Use of_property_present()
authorRob Herring (Arm) <robh@kernel.org>
Wed, 31 Jul 2024 19:12:42 +0000 (13:12 -0600)
committerStephen Boyd <sboyd@kernel.org>
Fri, 2 Aug 2024 23:53:38 +0000 (16:53 -0700)
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>
drivers/clk/clk.c
drivers/clk/renesas/clk-mstp.c
drivers/clk/versatile/clk-sp810.c

index 285ed1ad8a37807e9f1f8a77b53c4cc996a8c27f..7264cf6165ce141b846ce1a0bd82aa3e1de2392e 100644 (file)
@@ -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;
        }
index 5304c977562fc6850ba8046ea8c027eaa5ff55ef..5bc473c2adb33a9c1ac5ee1c6a18c4989cd483ae 100644 (file)
@@ -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";
index 45adac1b4630f03497fef1f7f8d087c9e7ed3590..033d4f78edc895242461de89dfc2f5eac17f59bc 100644 (file)
@@ -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);