[PATCH 09/10] OF: gpio: fix device_node leakage
Ahmad Fatoum
a.fatoum at pengutronix.de
Tue Jun 13 00:49:38 PDT 2023
On 02.06.23 09:49, Marco Felsch wrote:
> Drop the device_node after we are done.
>
> Signed-off-by: Marco Felsch <m.felsch at pengutronix.de>
There's no leakage fixed here. of_node_put is a no-op in barebox
and even in the kernel, it only does reference counting when
CONFIG_OF_DYNAMIC=y.
I don't mind if change is to align with kernel, so with commit
message reworded:
Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
> 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 c20133bbfd..76398f7542 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);
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list