From: Haowen Bai <baihaowen@meizu.com>
To: <mpe@ellerman.id.au>, <benh@kernel.crashing.org>, <paulus@samba.org>
Cc: Haowen Bai <baihaowen@meizu.com>,
linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH] powerpc/xmon: Fix warning comparing pointer to 0
Date: Thu, 24 Mar 2022 09:49:56 +0800 [thread overview]
Message-ID: <1648086596-26899-1-git-send-email-baihaowen@meizu.com> (raw)
Avoid pointer type value compared with 0 to make code clear.
Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
arch/powerpc/xmon/spu-dis.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/xmon/spu-dis.c b/arch/powerpc/xmon/spu-dis.c
index 4b0a4e6..6078aa5 100644
--- a/arch/powerpc/xmon/spu-dis.c
+++ b/arch/powerpc/xmon/spu-dis.c
@@ -34,7 +34,7 @@ init_spu_disassemble (void)
int o = spu_opcodes[i].opcode;
if (o >= SPU_DISASM_TBL_SIZE)
continue; /* abort (); */
- if (spu_disassemble_table[o] == 0)
+ if (!spu_disassemble_table[o])
spu_disassemble_table[o] = &spu_opcodes[i];
}
}
@@ -48,30 +48,30 @@ get_index_for_opcode (unsigned int insn)
/* Init the table. This assumes that element 0/opcode 0 (currently
* NOP) is always used */
- if (spu_disassemble_table[0] == 0)
+ if (!spu_disassemble_table[0])
init_spu_disassemble ();
- if ((index = spu_disassemble_table[opcode & 0x780]) != 0
+ if ((index = spu_disassemble_table[opcode & 0x780]) != NULL
&& index->insn_type == RRR)
return index;
- if ((index = spu_disassemble_table[opcode & 0x7f0]) != 0
+ if ((index = spu_disassemble_table[opcode & 0x7f0]) != NULL
&& (index->insn_type == RI18 || index->insn_type == LBT))
return index;
- if ((index = spu_disassemble_table[opcode & 0x7f8]) != 0
+ if ((index = spu_disassemble_table[opcode & 0x7f8]) != NULL
&& index->insn_type == RI10)
return index;
- if ((index = spu_disassemble_table[opcode & 0x7fc]) != 0
+ if ((index = spu_disassemble_table[opcode & 0x7fc]) != NULL
&& (index->insn_type == RI16))
return index;
- if ((index = spu_disassemble_table[opcode & 0x7fe]) != 0
+ if ((index = spu_disassemble_table[opcode & 0x7fe]) != NULL
&& (index->insn_type == RI8))
return index;
- if ((index = spu_disassemble_table[opcode & 0x7ff]) != 0)
+ if ((index = spu_disassemble_table[opcode & 0x7ff]) != NULL)
return index;
return NULL;
@@ -89,7 +89,7 @@ print_insn_spu (unsigned long insn, unsigned long memaddr)
index = get_index_for_opcode (insn);
- if (index == 0)
+ if (!index)
{
printf(".long 0x%lx", insn);
}
--
2.7.4
reply other threads:[~2022-03-24 1:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1648086596-26899-1-git-send-email-baihaowen@meizu.com \
--to=baihaowen@meizu.com \
--cc=benh@kernel.crashing.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).