Thread (24 messages) 24 messages, 3 authors, 2026-08-26

[PATCH v2 4/5] platform/x86: int3472: Release ACPI objects using __free()

flat view
COLD44d

From: Sakari Ailus <sakari.ailus@linux.intel.com>
Date: 2026-08-24 21:13:34
Also in: linux-media, platform-driver-x86
Subsystem: intel skylake int3472 acpi device driver, the rest, x86 platform drivers · Maintainers: Daniel Scally, Sakari Ailus, Linus Torvalds, Hans de Goede, Ilpo Järvinen

Use __free() to release ACPI objects received from
acpi_evaluate_dsm_typed() without explicit ACPI_FREE().

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
---
 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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help