[PATCH v1 1/1] spi: acpi: Free resource list at appropriate time
From: Andy Shevchenko
Date: Wed Jun 17 2026 - 05:26:38 EST
We do unneeded "double free" (emptying an empty list) in one case.
This is not a critical issue at all, the fix just makes code robust
against any possible future changes in the flow.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
---
drivers/spi/spi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 76e3563c523f..8b1ad1efddb2 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -2975,12 +2975,12 @@ struct spi_device *acpi_spi_device_alloc(struct spi_controller *ctlr,
INIT_LIST_HEAD(&resource_list);
ret = acpi_dev_get_resources(adev, &resource_list,
acpi_spi_add_resource, &lookup);
- acpi_dev_free_resource_list(&resource_list);
-
if (ret < 0)
/* Found SPI in _CRS but it points to another controller */
return ERR_PTR(ret);
+ acpi_dev_free_resource_list(&resource_list);
+
if (!lookup.max_speed_hz &&
ACPI_SUCCESS(acpi_get_parent(adev->handle, &parent_handle)) &&
device_match_acpi_handle(lookup.ctlr->dev.parent, parent_handle)) {
--
2.50.1