Re: [PATCH v2 4/5] platform/x86: int3472: Release ACPI objects using __free()
"Rafael J. Wysocki (Intel)" <[email protected]>
| Newsgroups | org.kernel.vger.linux-acpi,org.kernel.vger.linux-media,org.kernel.vger.platform-driver-x86 |
|---|---|
| Message-ID | <CAJZ5v0h41GA+O3u40eaKUy5uBDGGzg_KOuRJi5GEEa1z_dh63Q@mail.gmail.com> |
On Mon, Aug 24, 2026 at 11:13 PM Sakari Ailus <[email protected]> wrote: > > Use __free() to release ACPI objects received from > acpi_evaluate_dsm_typed() without explicit ACPI_FREE(). Well, the benefit of doing so is not entirely clear to me. At least there is more overhead in the new code, or am I mistaken? > Signed-off-by: Sakari Ailus <[email protected]> > --- > drivers/platform/x86/intel/int3472/discrete.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c > index b4a95b583edb..2024eaa09033 100644 > --- a/drivers/platform/x86/intel/int3472/discrete.c > +++ b/drivers/platform/x86/intel/int3472/discrete.c > @@ -4,6 +4,7 @@ > #include <linux/acpi.h> > #include <linux/array_size.h> > #include <linux/bitfield.h> > +#include <linux/cleanup.h> > #include <linux/device.h> > #include <linux/dmi.h> > #include <linux/gpio/consumer.h> > @@ -327,7 +328,6 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, > unsigned int enable_time_us; > u8 active_value, pin, type; > unsigned long gpio_flags; > - union acpi_object *obj; > struct gpio_desc *gpio; > const char *con_id; > int ret; > @@ -339,10 +339,11 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, > * ngpios + 2 because the index of this _DSM function is 1-based and > * the first function is just a count. > */ > - obj = acpi_evaluate_dsm_typed(int3472->adev->handle, > - &int3472_gpio_guid, 0x00, > - int3472->ngpios + 2, > - NULL, ACPI_TYPE_INTEGER); > + union acpi_object *obj __free(ACPI_FREE) = > + acpi_evaluate_dsm_typed(int3472->adev->handle, > + &int3472_gpio_guid, 0x00, > + int3472->ngpios + 2, > + NULL, ACPI_TYPE_INTEGER); > > if (!obj) { > dev_warn(int3472->dev, "No _DSM entry for GPIO pin %u\n", > @@ -433,7 +434,6 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, > } > > int3472->ngpios++; > - ACPI_FREE(obj); > > /* > * Either return an error or tell acpi_dev_get_resources() to not make a > -- > 2.47.3 >