Re: [PATCH v7 03/10] ACPI: property: Parse _CRS CSI-2 descriptor

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

 



On Tue, Mar 28, 2023 at 06:48:18PM +0300, Sakari Ailus wrote:
> On Tue, Mar 28, 2023 at 06:46:23PM +0300, Andy Shevchenko wrote:
> > On Tue, Mar 28, 2023 at 06:27:09PM +0300, Sakari Ailus wrote:
> > > On Tue, Mar 28, 2023 at 06:12:09PM +0300, Andy Shevchenko wrote:
> > > > On Tue, Mar 28, 2023 at 01:12:56PM +0300, Sakari Ailus wrote:

...

> > > > > +	struct scan_check_crs_csi2_context inst_context = {
> > > > > +		.handle = handle,
> > > > > +		.res_head = LIST_HEAD_INIT(inst_context.res_head),
> > > > > +	};
> > > > > +	struct crs_csi2 *csi2;
> > > > > +
> > > > > +	acpi_walk_resources(handle, METHOD_NAME__CRS,
> > > > > +			    scan_check_crs_csi2_instance, &inst_context);
> > > > > +
> > > > > +	if (list_empty(&inst_context.res_head))
> > > > > +		return;
> > > > > +
> > > > > +	/*
> > > > > +	 * Found entry, so allocate memory for it, fill it and add it to the
> > > > > +	 * list.
> > > > > +	 */
> > > > > +	csi2 = kmalloc(sizeof(*csi2), GFP_KERNEL);
> > > > > +	if (!csi2)
> > > > 
> > > > Who is going to release resources allocated in the callback above?
> > > 
> > > This is done by crs_csi2_release(), called from acpi_bus_scan_crs_csi2().
> > 
> > Isn't it a bit counter intuitive?
> 
> Are you suggesting changing something?
> 
> Basically we're gathering the information during an ACPI namespace walk.
> Once the information has been processed and used, the memory can be
> released.

Release allocated memory in the function which allocates it. Since it's called
via callback, the closest one is the one that calls acpi_walk_resources().

Can't we free them here?

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux