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] [day] [month] [year] [list]
Message-ID: <20240831113021.08a9010a@jic23-huawei>
Date: Sat, 31 Aug 2024 11:30:21 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Jinjie Ruan <ruanjinjie@...wei.com>
Cc: Kousik Sanagavarapu <five231003@...il.com>, <andrew@...n.ch>,
 <sebastian.hesselbarth@...il.com>, <gregory.clement@...tlin.com>,
 <herve.codina@...tlin.com>, <qiang.zhao@....com>,
 <christophe.leroy@...roup.eu>, <thierry.reding@...il.com>,
 <jonathanh@...dia.com>, <nm@...com>, <ssantosh@...nel.org>,
 <petlozup@...dia.com>, <pshete@...dia.com>,
 <christophe.jaillet@...adoo.fr>, <ulf.hansson@...aro.org>,
 <linux-arm-kernel@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
 <linuxppc-dev@...ts.ozlabs.org>, <linux-tegra@...r.kernel.org>,
 <krzk@...nel.org>, jonathan.cameron@...wei.com
Subject: Re: [PATCH -next 8/8] soc: ti: knav_qmss_queue: Simplify with
 scoped for each OF child loop

On Fri, 30 Aug 2024 11:24:14 +0800
Jinjie Ruan <ruanjinjie@...wei.com> wrote:

> On 2024/8/29 23:58, Kousik Sanagavarapu wrote:
> > Jinjie Ruan <ruanjinjie@...wei.com> writes:  
> >> @@ -1080,17 +1080,13 @@ static int knav_queue_setup_regions(struct knav_device *kdev,
> >>  {
> >>  	struct device *dev = kdev->dev;
> >>  	struct knav_region *region;
> >> -	struct device_node *child;
> >>  	u32 temp[2];
> >>  	int ret;
> >>  
> >> -	for_each_child_of_node(regions, child) {
> >> +	for_each_child_of_node_scoped(regions, child) {  
> > 
> > Are you sure using *_scoped() is better here?  Since it seems that we
> > need the memory pointed to by "child" in cases where we don't go into an
> > error path.  
> 
> Hi, Jonathan, could you help review this code?

I don't understand the review comment.
The reference counting before and after this patch is the same, just
with the error path handled in a simpler fashion and the scope of
the child variable reduced.


> 
> >   
> >>  		region = devm_kzalloc(dev, sizeof(*region), GFP_KERNEL);
> >> -		if (!region) {
> >> -			of_node_put(child);
> >> -			dev_err(dev, "out of memory allocating region\n");
> >> -			return -ENOMEM;
> >> -		}
> >> +		if (!region)
> >> +			return dev_err_probe(dev, -ENOMEM, "out of memory allocating region\n");
> >>  
> >>  		region->name = knav_queue_find_name(child);
> >>  		of_property_read_u32(child, "id", &region->id);  
> > 
> > Similarly in most of the other cases in this series where a similar
> > change is done.
> > 
> > Also FYI, as for dev_err_probe(), I think I covered all of them in this
> > file and a patch for it is currently sitting in ti-drivers-soc-next.
> > 
> > Thanks  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ