[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250728110849.00004062@huawei.com>
Date: Mon, 28 Jul 2025 11:08:49 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: James Morse <james.morse@....com>
CC: <linux-kernel@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
Rob Herring <robh@...nel.org>, Ben Horgan <ben.horgan@....com>, "Rohit
Mathew" <rohit.mathew@....com>, Shanker Donthineni <sdonthineni@...dia.com>,
Zeng Heng <zengheng4@...wei.com>, Lecopzer Chen <lecopzerc@...dia.com>, Carl
Worth <carl@...amperecomputing.com>, <shameerali.kolothum.thodi@...wei.com>,
D Scott Phillips OS <scott@...amperecomputing.com>, <lcherian@...vell.com>,
<bobo.shaobowang@...wei.com>, <tan.shaopeng@...itsu.com>,
<baolin.wang@...ux.alibaba.com>, Jamie Iles <quic_jiles@...cinc.com>, "Xin
Hao" <xhao@...ux.alibaba.com>, <peternewman@...gle.com>,
<dfustini@...libre.com>, <amitsinght@...vell.com>, David Hildenbrand
<david@...hat.com>, Rex Nie <rex.nie@...uarmicro.com>, Dave Martin
<dave.martin@....com>, Koba Ko <kobak@...dia.com>
Subject: Re: [RFC PATCH 10/36] ACPI / MPAM: Parse the MPAM table
> > +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;
> > +}
Powered by blists - more mailing lists