mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] greybus: es2: Use pointer from memcpy() call for assignment in output_async()
@ 2025-10-31 18:57 Markus Elfring
  2025-11-04 11:41 ` Johan Hovold
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2025-10-31 18:57 UTC (permalink / raw)
  To: greybus-dev, Alex Elder, Greg Kroah-Hartman, Johan Hovold
  Cc: LKML, kernel-janitors, Mark Greer, Miaoqian Lin

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 31 Oct 2025 19:50:39 +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/greybus/es2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/greybus/es2.c b/drivers/greybus/es2.c
index 7630a36ecf81..d71d37b41a66 100644
--- a/drivers/greybus/es2.c
+++ b/drivers/greybus/es2.c
@@ -194,8 +194,7 @@ static int output_async(struct es2_ap_dev *es2, void *req, u16 size, u8 cmd)
 		return -ENOMEM;
 	}
 
-	buf = (u8 *)dr + sizeof(*dr);
-	memcpy(buf, req, size);
+	buf = memcpy((u8 *)dr + sizeof(*dr), req, size);
 
 	dr->bRequest = cmd;
 	dr->bRequestType = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_INTERFACE;
-- 
2.51.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-11-04 12:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-10-31 18:57 [PATCH] greybus: es2: Use pointer from memcpy() call for assignment in output_async() Markus Elfring
2025-11-04 11:41 ` Johan Hovold
2025-11-04 11:55   ` Markus Elfring

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®