[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1605dd43-5e95-46eb-a0c6-78ff8b4d51b3@web.de>
Date: Thu, 30 Oct 2025 17:35:27 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: linux-alpha@...r.kernel.org, Chen Gang <gang.chen@...anux.com>,
 Matt Turner <mattst88@...il.com>,
 Richard Henderson <richard.henderson@...aro.org>
Cc: LKML <linux-kernel@...r.kernel.org>, kernel-janitors@...r.kernel.org,
 Miaoqian Lin <linmq006@...il.com>
Subject: [PATCH] alpha: Use pointers from memcpy() calls for assignments in
 two functions
From: Markus Elfring <elfring@...rs.sourceforge.net>
Date: Thu, 30 Oct 2025 17:24:27 +0100
A pointer was assigned to a variable in two function implementations.
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@...rs.sourceforge.net>
---
 arch/alpha/kernel/smp.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index ed06367ece57..8c7bc3ea7612 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -214,8 +214,7 @@ send_secondary_console_msg(char *str, int cpuid)
 	cp2 = str;
 	len = strlen(cp2);
 	*(unsigned int *)&cpu->ipc_buffer[0] = len;
-	cp1 = (char *) &cpu->ipc_buffer[1];
-	memcpy(cp1, cp2, len);
+	cp1 = memcpy(&cpu->ipc_buffer[1], cp2, len);
 
 	/* atomic test and set */
 	wmb();
@@ -265,8 +264,7 @@ recv_secondary_console_msg(void)
 			strcpy(buf, "<<< BOGUS MSG >>>");
 		else {
 			cp1 = (char *) &cpu->ipc_buffer[1];
-			cp2 = buf;
-			memcpy(cp2, cp1, cnt);
+			cp2 = memcpy(buf, cp1, cnt);
 			cp2[cnt] = '\0';
 			
 			while ((cp2 = strchr(cp2, '\r')) != 0) {
-- 
2.51.1
Powered by blists - more mailing lists
 
