[RFC PATCH 10/36] ACPI / MPAM: Parse the MPAM table

Jonathan Cameron Jonathan.Cameron at huawei.com
Mon Jul 28 03:08:49 PDT 2025


> > +static struct acpi_table_header *get_table(void)
> > +{
> > +	struct acpi_table_header *table;
> > +	acpi_status status;
> > +
> > +	if (acpi_disabled || !system_supports_mpam())
> > +		return NULL;
> > +
> > +	status = acpi_get_table(ACPI_SIG_MPAM, 0, &table);
> > +	if (ACPI_FAILURE(status))
> > +		return NULL;
> > +
> > +	if (table->revision != 1)

Missing an acpi_put_table()

I'm messing around with ACQUIRE() that is queued in the CXL tree
for the coming merge window and noticed this.
https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git/log/?h=for-6.17/cleanup-acquire

Interestingly this is a new corner case where we want conditional locking
style handling but with return_ptr() style handling. Maybe too much of a niche
to bother with infrastructure.

Worth noting though that one layer up it is probably worth something like:

DEFINE_FREE(acpi_table_mpam, struct acpi_table_header *, if (_T) acpi_put_table(_T));

That enables nice clean code like:


static int __init acpi_mpam_parse(void)
{
	struct acpi_table_header *mpam = __free(acpi_table_mpam) = get_table();

	if (!mpam)
		return 0;

	return _parse_table;
}

This series was big enough that I'm spinning a single 'suggested changes'
patch on top of it that includes stuff like this.  Might take another day or so.

Jonathan



> > +		return NULL;
> > +
> > +	return table;
> > +}



More information about the linux-arm-kernel mailing list