[PATCH linux-next] alpha:smp: fix warning comparing pointer to 0

Subsystems: alpha port, the rest

STALE1803d

2 messages, 2 authors, 2021-08-23 · open the first message on its own page

[PATCH linux-next] alpha:smp: fix warning comparing pointer to 0

From: CGEL <hidden>
Date: 2021-08-23 01:49:29

From: Jing Yangyang <redacted>

Fix the following coccicheck warning:
./arch/alpha/kernel/smp.c:271:39-40:
WARNING:comparing pointer to 0

Reported-by: Zeal Robot <redacted>
Signed-off-by: Jing Yangyang <redacted>
---
 arch/alpha/kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index cb64e47..adc05c2 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -268,7 +268,7 @@ enum ipi_message_type {
 			memcpy(cp2, cp1, cnt);
 			cp2[cnt] = '\0';
 			
-			while ((cp2 = strchr(cp2, '\r')) != 0) {
+			while ((cp2 = strchr(cp2, '\r'))) {
 				*cp2 = ' ';
 				if (cp2[1] == '\n')
 					cp2[1] = ' ';
-- 
1.8.3.1

Re: [PATCH linux-next] alpha:smp: fix warning comparing pointer to 0

From: Matt Turner <mattst88@gmail.com>
Date: 2021-08-23 02:02:13

On Sun, Aug 22, 2021 at 6:49 PM CGEL [off-list ref] wrote:
quoted hunk
From: Jing Yangyang <redacted>

Fix the following coccicheck warning:
./arch/alpha/kernel/smp.c:271:39-40:
WARNING:comparing pointer to 0

Reported-by: Zeal Robot <redacted>
Signed-off-by: Jing Yangyang <redacted>
---
 arch/alpha/kernel/smp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index cb64e47..adc05c2 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -268,7 +268,7 @@ enum ipi_message_type {
                        memcpy(cp2, cp1, cnt);
                        cp2[cnt] = '\0';

-                       while ((cp2 = strchr(cp2, '\r')) != 0) {
You may as well compare with NULL, for clarity.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help