pinctrl: samsung: Use of_property_present()
authorRob Herring (Arm) <robh@kernel.org>
Wed, 31 Jul 2024 19:12:54 +0000 (13:12 -0600)
committerKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Sun, 4 Aug 2024 09:09:06 +0000 (11:09 +0200)
Use of_property_present() to test for property presence rather than
of_find_property(). This is part of a larger effort to remove callers
of of_find_property() and similar functions. of_find_property() leaks
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-16-robh@kernel.org
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
drivers/pinctrl/samsung/pinctrl-samsung.c

index 623df65a5d6f9e60429d4d673c2a6aa1df04a419..855d6d99a253cf03f76babf1f1fdb74d6baf1227 100644 (file)
@@ -823,16 +823,16 @@ static struct samsung_pmx_func *samsung_pinctrl_create_functions(
                struct device_node *func_np;
 
                if (!of_get_child_count(cfg_np)) {
-                       if (!of_find_property(cfg_np,
-                           "samsung,pin-function", NULL))
+                       if (!of_property_present(cfg_np,
+                           "samsung,pin-function"))
                                continue;
                        ++func_cnt;
                        continue;
                }
 
                for_each_child_of_node(cfg_np, func_np) {
-                       if (!of_find_property(func_np,
-                           "samsung,pin-function", NULL))
+                       if (!of_property_present(func_np,
+                           "samsung,pin-function"))
                                continue;
                        ++func_cnt;
                }