* [PATCH] powerpc/xmon: Fix warning comparing pointer to 0
@ 2022-03-24 1:49 Haowen Bai
0 siblings, 0 replies; only message in thread
From: Haowen Bai @ 2022-03-24 1:49 UTC (permalink / raw)
To: mpe, benh, paulus; +Cc: Haowen Bai, linuxppc-dev, linux-kernel
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-24 1:50 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-24 1:49 [PATCH] powerpc/xmon: Fix warning comparing pointer to 0 Haowen Bai
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).