Skip to contentSkip to conversation

greybus: es2: Use pointer from memcpy() call for assignment in output_async()

PATCH In review Markus Elfring 2 participants 3 messages Oct 31, 2025 – Nov 4, 2025

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

PATCH 1/1 greybus: es2: Use pointer from memcpy() call for assignment in output_async()

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

---
 drivers/greybus/es2.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/greybus/es2.c +1 -2
index 7630a36ecf81..d71d37b41a66 100644
@@ -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;
Signature · 1 line
2.51.1
maintainer
#1 lore raw
Quoted 8 lines · Markus Elfring

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

Markus, stop sending these kind of crap patches that just wastes other people's time. You've had a number of maintainers reviewing the latest batch (including patches which apparently does not even compile) all telling you the same thing.

Quoted 1 line

The source code was transformed by using the Coccinelle software.

Since you know how to work with Coccinelle, at least try to come up with something that fixes actual bugs.

Johan

#2 lore raw
Quoted 2 lines

Since you know how to work with Coccinelle, at least try to come up with something that fixes actual bugs.

I became curious how development interests and resources will evolve further for such more advanced source code reviews.

Regards,
Markus