[PATCH] fpga: stratix10-soc: Use pointer from memcpy() call for assignment in s10_send_buf()

Markus Elfring posted 1 patch 3 months, 1 week ago
drivers/fpga/stratix10-soc.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] fpga: stratix10-soc: Use pointer from memcpy() call for assignment in s10_send_buf()
Posted by Markus Elfring 3 months, 1 week ago
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 31 Oct 2025 18:58:50 +0100

A pointer was assigned to a variable. The same pointer was used for
the destination parameter of a memcpy() call.
This function is documented in the way that the same value is returned.
Thus convert two separate statements into a direct variable assignment for
the return value from a memory copy action.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/fpga/stratix10-soc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/fpga/stratix10-soc.c b/drivers/fpga/stratix10-soc.c
index 0a295ccf1644..2e1167668ca8 100644
--- a/drivers/fpga/stratix10-soc.c
+++ b/drivers/fpga/stratix10-soc.c
@@ -257,8 +257,7 @@ static int s10_send_buf(struct fpga_manager *mgr, const char *buf, size_t count)
 
 	xfer_sz = count < SVC_BUF_SIZE ? count : SVC_BUF_SIZE;
 
-	svc_buf = priv->svc_bufs[i].buf;
-	memcpy(svc_buf, buf, xfer_sz);
+	svc_buf = memcpy(priv->svc_bufs[i].buf, buf, xfer_sz);
 	ret = s10_svc_send_msg(priv, COMMAND_RECONFIG_DATA_SUBMIT,
 			       svc_buf, xfer_sz);
 	if (ret < 0) {
-- 
2.51.1