Skip to contentSkip to conversation

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

PATCH New Markus Elfring 1 participant 1 message Oct 31, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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

From: Markus Elfring <[email protected]>
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.

---
 drivers/fpga/stratix10-soc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/fpga/stratix10-soc.c +1 -2
index 0a295ccf1644..2e1167668ca8 100644
@@ -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) {
Signature · 1 line
2.51.1