Skip to contentSkip to conversation

pinctrl: mediatek: Use of_property_read_bool()

PATCH In review Rob Herring (Arm) 3 participants 3 messages Jul 31, 2024 – Aug 23, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: mediatek: Use of_property_read_bool()

Use of_property_read_bool() to read boolean properties 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.

---
 drivers/pinctrl/mediatek/pinctrl-paris.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/pinctrl/mediatek/pinctrl-paris.c +2 -5
index e12316c42698..87e958d827bf 100644
@@ -1044,11 +1044,8 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev)
 
 	hw->nbase = hw->soc->nbase_names;
 
-	if (of_find_property(hw->dev->of_node,
-			     "mediatek,rsel-resistance-in-si-unit", NULL))
-		hw->rsel_si_unit = true;
-	else
-		hw->rsel_si_unit = false;
+	hw->rsel_si_unit = of_property_read_bool(hw->dev->of_node,
+						 "mediatek,rsel-resistance-in-si-unit");
 
 	spin_lock_init(&hw->lock);
 
Signature · 1 line
2.43.0
maintainer Reviewed-by on v1 1/1
#1 lore raw

Il 31/07/24 21:13, Rob Herring (Arm) ha scritto:

Quoted 7 lines

Use of_property_read_bool() to read boolean properties 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.

#2 lore raw
In reply to Rob Herring (Arm)
Quoted 7 lines · Rob Herring (Arm)

Use of_property_read_bool() to read boolean properties 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.

Patch applied!

Yours,
Linus Walleij