linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next] alpha:smp: fix warning comparing pointer to 0
@ 2021-08-23  1:49 CGEL
  2021-08-23  2:01 ` Matt Turner
  0 siblings, 1 reply; 2+ messages in thread
From: CGEL @ 2021-08-23  1:49 UTC (permalink / raw)
  To: Richard Henderson
  Cc: Ivan Kokshaysky, Matt Turner, linux-alpha, linux-kernel,
	Jing Yangyang, Zeal Robot

From: Jing Yangyang <jing.yangyang@zte.com.cn>

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

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Jing Yangyang <jing.yangyang@zte.com.cn>
---
 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



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

* Re: [PATCH linux-next] alpha:smp: fix warning comparing pointer to 0
  2021-08-23  1:49 [PATCH linux-next] alpha:smp: fix warning comparing pointer to 0 CGEL
@ 2021-08-23  2:01 ` Matt Turner
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Turner @ 2021-08-23  2:01 UTC (permalink / raw)
  To: CGEL
  Cc: Richard Henderson, Ivan Kokshaysky, linux-alpha, LKML,
	Jing Yangyang, Zeal Robot

On Sun, Aug 22, 2021 at 6:49 PM CGEL <cgel.zte@gmail.com> wrote:
>
> From: Jing Yangyang <jing.yangyang@zte.com.cn>
>
> Fix the following coccicheck warning:
> ./arch/alpha/kernel/smp.c:271:39-40:
> WARNING:comparing pointer to 0
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Jing Yangyang <jing.yangyang@zte.com.cn>
> ---
>  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.

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

end of thread, other threads:[~2021-08-23  2:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23  1:49 [PATCH linux-next] alpha:smp: fix warning comparing pointer to 0 CGEL
2021-08-23  2:01 ` Matt Turner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).