linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pinctrl: mediatek: Use of_property_read_bool()
@ 2024-07-31 19:13 Rob Herring (Arm)
  2024-08-01  8:22 ` AngeloGioacchino Del Regno
  2024-08-23 15:38 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Rob Herring (Arm) @ 2024-07-31 19:13 UTC (permalink / raw)
  To: Sean Wang, Linus Walleij, Matthias Brugger,
	AngeloGioacchino Del Regno
  Cc: linux-mediatek, linux-gpio, linux-kernel, linux-arm-kernel

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.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
---
 drivers/pinctrl/mediatek/pinctrl-paris.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/mediatek/pinctrl-paris.c b/drivers/pinctrl/mediatek/pinctrl-paris.c
index e12316c42698..87e958d827bf 100644
--- a/drivers/pinctrl/mediatek/pinctrl-paris.c
+++ b/drivers/pinctrl/mediatek/pinctrl-paris.c
@@ -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);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: mediatek: Use of_property_read_bool()
  2024-07-31 19:13 [PATCH] pinctrl: mediatek: Use of_property_read_bool() Rob Herring (Arm)
@ 2024-08-01  8:22 ` AngeloGioacchino Del Regno
  2024-08-23 15:38 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: AngeloGioacchino Del Regno @ 2024-08-01  8:22 UTC (permalink / raw)
  To: Rob Herring (Arm), Sean Wang, Linus Walleij, Matthias Brugger
  Cc: linux-mediatek, linux-gpio, linux-kernel, linux-arm-kernel

Il 31/07/24 21:13, Rob Herring (Arm) ha scritto:
> 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.
> 
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] pinctrl: mediatek: Use of_property_read_bool()
  2024-07-31 19:13 [PATCH] pinctrl: mediatek: Use of_property_read_bool() Rob Herring (Arm)
  2024-08-01  8:22 ` AngeloGioacchino Del Regno
@ 2024-08-23 15:38 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2024-08-23 15:38 UTC (permalink / raw)
  To: Rob Herring (Arm)
  Cc: Sean Wang, Matthias Brugger, AngeloGioacchino Del Regno,
	linux-mediatek, linux-gpio, linux-kernel, linux-arm-kernel

On Wed, Jul 31, 2024 at 9:14 PM Rob Herring (Arm) <robh@kernel.org> wrote:

> 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.
>
> Signed-off-by: Rob Herring (Arm) <robh@kernel.org>

Patch applied!

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-08-23 15:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-31 19:13 [PATCH] pinctrl: mediatek: Use of_property_read_bool() Rob Herring (Arm)
2024-08-01  8:22 ` AngeloGioacchino Del Regno
2024-08-23 15:38 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).