All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] i2c: acpi: Free resource list at appropriate time
@ 2026-06-17  9:20 Andy Shevchenko
  2026-06-17 13:02 ` Mika Westerberg
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2026-06-17  9:20 UTC (permalink / raw)
  To: Andy Shevchenko, linux-i2c, linux-acpi, linux-kernel
  Cc: Andi Shyti, Mika Westerberg, hardikprakash.official

We do unneeded "double free" (emptying an empty list) in one case.
At the same time we shadow a real error code. Address them by
refactoring the code in question.

Both are not critical issues at all, they just make code robust
against any possible future changes in the flow.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/i2c/i2c-core-acpi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c
index e5fddacae9a4..c13cf29a9092 100644
--- a/drivers/i2c/i2c-core-acpi.c
+++ b/drivers/i2c/i2c-core-acpi.c
@@ -168,9 +168,12 @@ static int i2c_acpi_do_lookup(struct acpi_device *adev,
 	INIT_LIST_HEAD(&resource_list);
 	ret = acpi_dev_get_resources(adev, &resource_list,
 				     i2c_acpi_fill_info, lookup);
+	if (ret < 0)
+		return ret;
+
 	acpi_dev_free_resource_list(&resource_list);
 
-	if (ret < 0 || !info->addr)
+	if (!info->addr)
 		return -EINVAL;
 
 	return 0;
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 1/1] i2c: acpi: Free resource list at appropriate time
  2026-06-17  9:20 [PATCH v1 1/1] i2c: acpi: Free resource list at appropriate time Andy Shevchenko
@ 2026-06-17 13:02 ` Mika Westerberg
  0 siblings, 0 replies; 2+ messages in thread
From: Mika Westerberg @ 2026-06-17 13:02 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-i2c, linux-acpi, linux-kernel, Andi Shyti, Mika Westerberg,
	hardikprakash.official

On Wed, Jun 17, 2026 at 11:20:46AM +0200, Andy Shevchenko wrote:
> We do unneeded "double free" (emptying an empty list) in one case.
> At the same time we shadow a real error code. Address them by
> refactoring the code in question.
> 
> Both are not critical issues at all, they just make code robust
> against any possible future changes in the flow.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-17 13:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-17  9:20 [PATCH v1 1/1] i2c: acpi: Free resource list at appropriate time Andy Shevchenko
2026-06-17 13:02 ` Mika Westerberg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.