[PATCH 1/2] gpio: don't process hogs on disabled nodes

From: Bartosz Golaszewski

Date: Tue Jun 09 2026 - 08:26:19 EST


The core hogging logic uses device_for_each_child_node_scoped(), which
iterates over all child firmware nodes without checking their
availability. Before the code was moved to the GPIO core, it correctly
used for_each_available_child_of_node_scoped() to skip disabled nodes.
Check if the node is available and skip it if not.

Closes: https://sashiko.dev/#/patchset/20260608210108.36248-1-dan%40reactivated.net
Fixes: d1d564ec4992 ("gpio: move hogs into GPIO core")
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
---
drivers/gpio/gpiolib.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 7bb6f114d64d9ce3eb930f1d79d0224bf7920c37..1fc7ee9e1158d21f7c75e6cb95c33f0af44835c8 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1052,7 +1052,8 @@ static int gpiochip_hog_lines(struct gpio_chip *gc)
int ret;

device_for_each_child_node_scoped(&gc->gpiodev->dev, fwnode) {
- if (!fwnode_property_present(fwnode, "gpio-hog"))
+ if (!fwnode_device_is_available(fwnode) ||
+ !fwnode_property_present(fwnode, "gpio-hog"))
continue;

ret = gpiochip_add_hog(gc, fwnode);

--
2.47.3