From: KobaK <kobak@nvidia.com>
To: Matt Ochs <mochs@nvidia.com>, James Morse <james.morse@arm.com>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Len Brown <lenb@kernel.org>,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
Zhang Rui <rui.zhang@intel.com>,
linux-efi@vger.kernel.org,
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: [PATCH 2/2 V6] acpi/prmt: refactor acpi_platformrt_space_handler to drop gotos
Date: Sun, 6 Oct 2024 23:36:11 +0800 [thread overview]
Message-ID: <20241006153611.1165482-2-kobak@nvidia.com> (raw)
In-Reply-To: <20241006153611.1165482-1-kobak@nvidia.com>
From: koba ko <kobak@nvidia.com>
Replace gotos with returns
Signed-off-by: koba ko <kobak@nvidia.com>
---
drivers/acpi/prmt.c | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/drivers/acpi/prmt.c b/drivers/acpi/prmt.c
index 970207bc8f4a..b0cf4428f7e3 100644
--- a/drivers/acpi/prmt.c
+++ b/drivers/acpi/prmt.c
@@ -288,8 +288,10 @@ static acpi_status acpi_platformrt_space_handler(u32 function,
handler = find_prm_handler(&buffer->handler_guid);
module = find_prm_module(&buffer->handler_guid);
- if (!handler || !module)
- goto invalid_guid;
+ if (!handler || !module) {
+ buffer->prm_status = PRM_HANDLER_GUID_NOT_FOUND;
+ return AE_OK;
+ }
if (!handler->handler_addr || !handler->static_data_buffer_addr ||
!handler->acpi_param_buffer_addr) {
@@ -318,8 +320,10 @@ static acpi_status acpi_platformrt_space_handler(u32 function,
case PRM_CMD_START_TRANSACTION:
module = find_prm_module(&buffer->handler_guid);
- if (!module)
- goto invalid_guid;
+ if (!module) {
+ buffer->prm_status = PRM_HANDLER_GUID_NOT_FOUND;
+ return AE_OK;
+ }
if (module->updatable)
module->updatable = false;
@@ -330,8 +334,10 @@ static acpi_status acpi_platformrt_space_handler(u32 function,
case PRM_CMD_END_TRANSACTION:
module = find_prm_module(&buffer->handler_guid);
- if (!module)
- goto invalid_guid;
+ if (!module) {
+ buffer->prm_status = PRM_HANDLER_GUID_NOT_FOUND;
+ return AE_OK;
+ }
if (module->updatable)
buffer->prm_status = UPDATE_UNLOCK_WITHOUT_LOCK;
@@ -346,10 +352,6 @@ static acpi_status acpi_platformrt_space_handler(u32 function,
}
return AE_OK;
-
-invalid_guid:
- buffer->prm_status = PRM_HANDLER_GUID_NOT_FOUND;
- return AE_OK;
}
void __init init_prmt(void)
--
2.43.0
next prev parent reply other threads:[~2024-10-06 15:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-06 15:36 [PATCH 1/2 V6] acpi/prmt: find block with specific type KobaK
2024-10-06 15:36 ` KobaK [this message]
2024-10-08 3:24 ` [PATCH 2/2 V6] acpi/prmt: refactor acpi_platformrt_space_handler to drop gotos Zhang, Rui
2024-10-08 9:11 ` Ard Biesheuvel
2024-10-08 5:27 ` [PATCH 1/2 V6] acpi/prmt: find block with specific type Zhang, Rui
2024-10-08 6:45 ` Ard Biesheuvel
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=20241006153611.1165482-2-kobak@nvidia.com \
--to=kobak@nvidia.com \
--cc=ard.biesheuvel@linaro.org \
--cc=james.morse@arm.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mochs@nvidia.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@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