From: Marco Felsch <m.felsch@xxxxxxxxxxxxxx> This aligns us with the Linux implementation. There's no functional change though, because of_node_put is a stub in barebox (same as when compiling kernel without CONFIG_OF_DYNAMIC enabled). Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx> Reviewed-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- v1 -> v2: - reword commit message to make it clearer that patch is a no-op in barebox --- drivers/of/of_gpio.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/of/of_gpio.c b/drivers/of/of_gpio.c index c20133bbfd6f..76398f75422f 100644 --- a/drivers/of/of_gpio.c +++ b/drivers/of/of_gpio.c @@ -76,16 +76,17 @@ int of_get_named_gpio_flags(struct device_node *np, const char *propname, if (!dev) { pr_debug("%s: unable to find device of node %s\n", __func__, gpiospec.np->full_name); - return -EPROBE_DEFER; + ret = -EPROBE_DEFER; + goto out; } ret = gpio_get_num(dev, gpiospec.args[0]); if (ret == -EPROBE_DEFER) - return ret; + goto out; if (ret < 0) { pr_err("%s: unable to get gpio num of device %s: %d\n", __func__, dev_name(dev), ret); - return ret; + goto out; } if (flags) { @@ -93,6 +94,9 @@ int of_get_named_gpio_flags(struct device_node *np, const char *propname, of_gpio_flags_quirks(np, propname, flags, index); } +out: + of_node_put(gpiospec.np); + return ret; } EXPORT_SYMBOL(of_get_named_gpio_flags); -- 2.39.2