Re: [PATCH 09/10] OF: gpio: fix device_node leakage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23-06-13, Ahmad Fatoum wrote:
> On 02.06.23 09:49, Marco Felsch wrote:
> > Drop the device_node after we are done.
> > 
> > Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
> 
> 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.

Didn't noticed that of_node_put() is a no-op but since barebox does
start to handle of-overlays for its own devicetrees we should reconsider
that.

> I don't mind if change is to align with kernel, so with commit
> message reworded:

Sure.

Regards,
  Marco

> 
> Reviewed-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx>
> 
> > ---
> >  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 |
> 
> 




[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux