From: Gregory Williams <gregory.williams@amd.com>
To: Michal Simek <michal.simek@amd.com>,
Izhar Ameer Shaikh <izhar.ameer.shaikh@amd.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jay Buddhabhatti <jay.buddhabhatti@amd.com>,
Ronak Jain <ronak.jain@amd.com>
Cc: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH 02/15] firmware: xilinx: Call va_start after pm feature check
Date: Wed, 18 Nov 2026 15:31:58 -0800 [thread overview]
Message-ID: <20261118233211.4121361-3-gregory.williams@amd.com> (raw)
In-Reply-To: <20261118233211.4121361-1-gregory.williams@amd.com>
From: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>
zynqmp_pm_invoke_fw_fn() and zynqmp_pm_invoke_fn() call va_start() before
checking whether the PM API is supported. If the feature check fails, the
function returns early without a matching va_end().
Per the C standard, every va_start() must be paired with va_end() on every
exit path; calling va_start() and returning without va_end() is undefined
behavior.
Move va_start() to after the feature check so it is only invoked when the
va_list will actually be consumed.
Fixes: f922b16aa5fa ("firmware: xilinx: Update firmware call interface to support additional args")
Fixes: 92fb71333d57 ("firmware: xilinx: add support for new SMC call format")
Signed-off-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Senthil Nathan Thangaraj <senthilnathan.thangaraj@amd.com>
---
drivers/firmware/xilinx/zynqmp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c
index 940306079a78..e264a1914f06 100644
--- a/drivers/firmware/xilinx/zynqmp.c
+++ b/drivers/firmware/xilinx/zynqmp.c
@@ -457,13 +457,13 @@ int zynqmp_pm_invoke_fw_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
if (num_args > SMC_ARG_CNT_32)
return -EINVAL;
- va_start(arg_list, num_args);
-
/* Check if feature is supported or not */
ret = zynqmp_pm_feature(pm_api_id);
if (ret < 0)
return ret;
+ va_start(arg_list, num_args);
+
for (i = 0; i < num_args; i++)
args[i] = va_arg(arg_list, u32);
@@ -520,13 +520,13 @@ int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 *ret_payload, u32 num_args, ...)
if (num_args > 14)
return -EINVAL;
- va_start(arg_list, num_args);
-
/* Check if feature is supported or not */
ret = zynqmp_pm_feature(pm_api_id);
if (ret < 0)
return ret;
+ va_start(arg_list, num_args);
+
for (i = 0; i < num_args; i++)
args[i] = va_arg(arg_list, u32);
--
2.34.1
next prev parent reply other threads:[~2026-11-18 23:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 23:31 [PATCH 00/15] accel: Add AMD Versal AI Engine driver (with Versal Gen 2 firmware support) Gregory Williams
2026-11-18 23:31 ` [PATCH 01/15] firmware: xilinx: Separate TF-A checking Gregory Williams
2026-11-18 23:31 ` Gregory Williams [this message]
2026-11-18 23:31 ` [PATCH 03/15] firmware: xilinx: Add comments about number of arguments Gregory Williams
2026-11-18 23:32 ` [PATCH 04/15] firmware: xilinx: Use match data for ZynqMP/Versal Gregory Williams
2026-11-18 23:32 ` [PATCH 05/15] firmware: xilinx: Rename zynqmp_pm_invoke_fw_fn() Gregory Williams
2026-11-18 23:32 ` [PATCH 06/15] dt-bindings: firmware: xilinx: Add Versal Gen 2 compatible string Gregory Williams
2026-11-18 23:32 ` [PATCH 07/15] firmware: xilinx: Add support for Versal Gen 2 Gregory Williams
2026-11-18 23:32 ` [PATCH 08/15] dt-bindings: clock: versal: add Versal Gen 2 compatible string Gregory Williams
2026-11-18 23:32 ` [PATCH 09/15] clk: zynqmp: Add " Gregory Williams
2026-11-18 23:32 ` [PATCH 10/15] drivers: firmware: xilinx: Add IOCTL support for the AIE run time operations Gregory Williams
2026-11-18 23:32 ` [PATCH 11/15] dt-bindings: soc: xilinx: Add Versal AI Engine DT binding Gregory Williams
2026-11-18 23:32 ` [PATCH 12/15] accel/amd-ai-engine: Add AMD AI Engine device driver Gregory Williams
2026-11-18 23:32 ` [PATCH 13/15] accel/amd-ai-engine: Add pm ops for firmware calls Gregory Williams
2026-11-18 23:32 ` [PATCH 14/15] accel/amd-ai-engine: Add support to enable/disable tile clocks Gregory Williams
2026-11-18 23:32 ` [PATCH 15/15] accel/amd-ai-engine: Add reset operations Gregory Williams
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=20261118233211.4121361-3-gregory.williams@amd.com \
--to=gregory.williams@amd.com \
--cc=gregkh@linuxfoundation.org \
--cc=izhar.ameer.shaikh@amd.com \
--cc=jay.buddhabhatti@amd.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.com \
--cc=ronak.jain@amd.com \
--cc=senthilnathan.thangaraj@amd.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
all inboxes | Powered by JetHome®