]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
gpio: shared: ignore disabled nodes when traversing the device-tree
authorBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Wed, 3 Dec 2025 09:23:09 +0000 (10:23 +0100)
committerBartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Tue, 9 Dec 2025 06:14:53 +0000 (07:14 +0100)
Don't consider disabled devices when traversing the device-tree looking
for shared GPIOs. Even if they do share a phandle to a pin, they can
never be instantiated and request it.

Fixes: a060b8c511ab ("gpiolib: implement low-level, shared GPIO support")
Link: https://lore.kernel.org/r/20251203092309.34737-1-bartosz.golaszewski@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
drivers/gpio/gpiolib-shared.c

index 8bdd107b1ad1d2fbd9742de20cf59f0820a2b267..5d15675d61ea52b21a8181ef9a93123774b8e7c3 100644 (file)
@@ -77,6 +77,10 @@ gpio_shared_find_entry(struct fwnode_handle *controller_node,
 /* Handle all special nodes that we should ignore. */
 static bool gpio_shared_of_node_ignore(struct device_node *node)
 {
+       /* Ignore disabled devices. */
+       if (!of_device_is_available(node))
+               return true;
+
        /*
         * __symbols__ is a special, internal node and should not be considered
         * when scanning for shared GPIOs.