Re: [PATCH -next 8/8] soc: ti: knav_qmss_queue: Simplify with scoped for each OF child loop

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

 



On 21:28-20240829, Kousik Sanagavarapu wrote:
> Jinjie Ruan <ruanjinjie@xxxxxxxxxx> 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.
> 
> >  		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 Kousik. yeah - it will probably help with a rebase to latest
next.

-- 
Regards,
Nishanth Menon
Key (0xDDB5849D1736249D) / Fingerprint: F8A2 8693 54EB 8232 17A3  1A34 DDB5 849D 1736 249D




[Index of Archives]     [ARM Kernel]     [Linux ARM]     [Linux ARM MSM]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux