From 8cf442372901897cf261aa7602af6791e3f1833e Mon Sep 17 00:00:00 2001 From: Phil Elwell Date: Wed, 29 Apr 2026 15:05:18 +0100 Subject: [PATCH] fixup! gpiolib: Override gpiochip numbers with DT aliases Commit [1] shuffled the initialisation of gpiochips, breaking the downstream patch that sets the chip numbers based on DT aliases. Fix the downstream patch by determining the of_node on the fly, rather than assuming it has already been set. This does result in more calls to gpiochip_choose_fwnode() than are necessary, but it reduces the scope of the patch and makes it more resilient. Signed-off-by: Phil Elwell [1] 16fdabe143fc ("gpio: Fix resource leaks on errors in gpiochip_add_data_with_key()") --- drivers/gpio/gpiolib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index de62a64911c8e..79a5b6f14232f 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1092,7 +1092,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data, first_dynamic_gpiochip_num = (id >= 0) ? (id + 1) : 0; } - id = of_alias_get_id(gdev->dev.of_node, "gpiochip"); + id = of_alias_get_id(to_of_node(gpiochip_choose_fwnode(gc)), "gpiochip"); if (id < 0) id = first_dynamic_gpiochip_num;