dev_gpiod_get_index takes both a consumer device and a consumer device tree node. The consumer device tree node should be used for all lookups, but it was used only for one of two lookups so far. This would break using the function on subnodes of a device, so remedy that. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- drivers/gpio/gpiolib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 4a1792a8df1f..5d5458374869 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1018,8 +1018,7 @@ struct gpio_desc *dev_gpiod_get_index(struct device *dev, if (!pp) return ERR_PTR(-ENOENT); - gpio = of_get_named_gpio_flags(dev->device_node, pp->name, - index, &of_flags); + gpio = of_get_named_gpio_flags(np, pp->name, index, &of_flags); if (!gpio_is_valid(gpio)) return ERR_PTR(gpio < 0 ? gpio : -EINVAL); -- 2.39.2