lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250220091215.41eeb5f9@bootlin.com>
Date: Thu, 20 Feb 2025 09:12:15 +0100
From: Herve Codina <herve.codina@...tlin.com>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, "Rafael J. Wysocki"
 <rafael@...nel.org>, Danilo Krummrich <dakr@...nel.org>, Rob Herring
 <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>, Bjorn Helgaas
 <bhelgaas@...gle.com>, Lizhi Hou <lizhi.hou@....com>,
 <linux-kernel@...r.kernel.org>, <devicetree@...r.kernel.org>,
 <linux-pci@...r.kernel.org>, Allan Nielsen <allan.nielsen@...rochip.com>,
 Horatiu Vultur <horatiu.vultur@...rochip.com>, Steen Hegelund
 <steen.hegelund@...rochip.com>, Thomas Petazzoni
 <thomas.petazzoni@...tlin.com>
Subject: Re: [PATCH v7 1/5] driver core: Introduce
 device_{add,remove}_of_node()

Hi Jonathan,

On Wed, 19 Feb 2025 15:59:01 +0000
Jonathan Cameron <Jonathan.Cameron@...wei.com> wrote:

...

> > Signed-off-by: Herve Codina <herve.codina@...tlin.com>  
> A few passing comments. Not suggestions to actually change anything
> at this stage though. Maybe a potential follow up if you think it's
> a good idea.
> 
...

> > +void device_remove_of_node(struct device *dev)
> > +{
> > +	dev = get_device(dev);
> > +	if (!dev)
> > +		return;  
> Maybe use
> 	struct device *d __free(put_device) = get_device(dev);
> 
> 	if (!d->of_node);
> 		return;
> 
> Not a reason to respin though!
> 
> 
...

> > +int device_add_of_node(struct device *dev, struct device_node *of_node)
> > +{
> > +	int ret;
> > +
> > +	if (!of_node)
> > +		return -EINVAL;
> > +
> > +	dev = get_device(dev);  
> 
> Likewise could use __free() magic here as well for slight simpliciations.
> 

I see. Indeed, the __free(put_device) can be an improvement in core.c

I think that this has to be done out of this series in a more globally way
because put_device() is used in several place in this file and having a mix
between __free(put_device) and put_device() calls in a goto label is not the
best solution.

For this reason, as you proposed except if someone else pushes in the
__free(put_device) direction in functions introduced in this patch, I
prefer to keep this patch as it is.

Thanks for your feedback,
Hervé

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ