[PATCH 2/4] arm: socfpga: mailbox_s10: cleanup send command
Michael Tretter
m.tretter at pengutronix.de
Wed Mar 11 04:06:40 PDT 2026
The casts when passing the response buffer to mbox_send_cmd are useless,
because they already have the correct type.
Furthermore, setting an explicit buffer length is surprising and error
prone. Just use the array size of the response buffer as length.
Signed-off-by: Michael Tretter <m.tretter at pengutronix.de>
---
arch/arm/mach-socfpga/mailbox_s10.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/arch/arm/mach-socfpga/mailbox_s10.c b/arch/arm/mach-socfpga/mailbox_s10.c
index f9ff6663dc38..f6aacd5551f2 100644
--- a/arch/arm/mach-socfpga/mailbox_s10.c
+++ b/arch/arm/mach-socfpga/mailbox_s10.c
@@ -297,8 +297,8 @@ int socfpga_mailbox_s10_qspi_close(void)
int socfpga_mailbox_s10_qspi_open(void)
{
int ret;
- u32 resp_buf[1];
- u32 resp_buf_len;
+ u32 resp_buf[1] = {};
+ u32 resp_buf_len = ARRAY_SIZE(resp_buf);
u32 reg;
u32 clk_khz;
int try = 0;
@@ -315,10 +315,8 @@ int socfpga_mailbox_s10_qspi_open(void)
return ret;
/* HPS will directly control the QSPI controller, no longer mailbox */
- resp_buf_len = 1;
ret = mbox_send_cmd(MBOX_ID_BAREBOX, MBOX_QSPI_DIRECT, MBOX_CMD_DIRECT,
- 0, NULL, 0, (u32 *)&resp_buf_len,
- (u32 *)&resp_buf);
+ 0, NULL, 0, &resp_buf_len, resp_buf);
if (ret)
goto error;
--
2.47.3
More information about the barebox
mailing list