From: Marco Scardovi <mscardovi95@gmail.com>
To: mika.westerberg@intel.com
Cc: mathias.nyman@intel.com, andriy.shevchenko@intel.com,
linux-gpio@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org,
Marco Scardovi <mscardovi95@gmail.com>
Subject: [PATCH v2 3/3] [PATCH 3/3] gpio: acpi: modernize resource management using cleanup.h
Date: Wed, 6 May 2026 14:35:36 +0200 [thread overview]
Message-ID: <20260506123637.1077421-5-mscardovi95@gmail.com> (raw)
In-Reply-To: <20260506123637.1077421-1-mscardovi95@gmail.com>
---
drivers/gpio/gpiolib-acpi-core.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/gpio/gpiolib-acpi-core.c b/drivers/gpio/gpiolib-acpi-core.c
index b6accbaba04d..7b6476b90f13 100644
--- a/drivers/gpio/gpiolib-acpi-core.c
+++ b/drivers/gpio/gpiolib-acpi-core.c
@@ -1126,7 +1126,7 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
u16 word, shift;
bool found;
- mutex_lock(&achip->conn_lock);
+ guard(mutex)(&achip->conn_lock);
found = false;
list_for_each_entry(conn, &achip->conns, node) {
@@ -1158,17 +1158,15 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
if (!found) {
desc = acpi_request_own_gpiod(chip, agpio, i, "ACPI:OpRegion");
if (IS_ERR(desc)) {
- mutex_unlock(&achip->conn_lock);
status = AE_ERROR;
- goto out;
+ break;
}
conn = kzalloc_obj(*conn);
if (!conn) {
gpiochip_free_own_desc(desc);
- mutex_unlock(&achip->conn_lock);
status = AE_NO_MEMORY;
- goto out;
+ break;
}
conn->pin = pin;
@@ -1176,8 +1174,6 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
list_add_tail(&conn->node, &achip->conns);
}
- mutex_unlock(&achip->conn_lock);
-
/*
* For the cases when OperationRegion() consists of more than
* 64 bits calculate the word and bit shift to use that one to
@@ -1196,8 +1192,6 @@ acpi_gpio_adr_space_handler(u32 function, acpi_physical_address address,
}
}
-out:
- ACPI_FREE(ares);
return status;
}
--
2.54.0
prev parent reply other threads:[~2026-05-06 12:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260506113215.GK6785@://intel.com>
2026-05-06 12:34 ` [PATCH v2 0/3] gpio: acpi: modernize resource management using cleanup.h Marco Scardovi
2026-05-06 12:49 ` Andy Shevchenko
2026-05-06 12:35 ` Marco Scardovi
2026-05-06 12:35 ` Marco Scardovi
2026-05-06 12:35 ` [PATCH v2 1/3] [PATCH 1/3] " Marco Scardovi
2026-05-06 12:51 ` Andy Shevchenko
2026-05-06 12:35 ` [PATCH v2 2/3] [PATCH 2/3] " Marco Scardovi
2026-05-06 12:35 ` Marco Scardovi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260506123637.1077421-5-mscardovi95@gmail.com \
--to=mscardovi95@gmail.com \
--cc=andriy.shevchenko@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=mika.westerberg@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox