When comparing a pointer, it's clearer to compare it to NULL than to 0.
Here is an excerpt of the semantic patch:
@@
expression *E;
@@
E ==
- 0
+ NULL
@@
expression *E;
@@
E !=
- 0
+ NULL
Signed-off-by: Yoann Padioleau <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
---
kernel/smp.c | 4 ++--
kernel/traps.c | 2 +-
mm/fault.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/alpha/kernel/smp.c b/arch/alpha/kernel/smp.c
index b287314..4317a7c 100644
--- a/arch/alpha/kernel/smp.c
+++ b/arch/alpha/kernel/smp.c
@@ -270,7 +270,7 @@ recv_secondary_console_msg(void)
cp2 = buf;
strcpy(cp2, cp1);
- while ((cp2 = strchr(cp2, '\r')) != 0) {
+ while ((cp2 = strchr(cp2, '\r')) != NULL) {
*cp2 = ' ';
if (cp2[1] == '\n')
cp2[1] = ' ';
@@ -597,7 +597,7 @@ pointer_lock (void *lock, void *data, in
: "r"(data)
: "memory");
- if (old == 0)
+ if (old == NULL)
return 0;
if (! retry)
return -EBUSY;
diff --git a/arch/alpha/kernel/traps.c b/arch/alpha/kernel/traps.c
index ec0f05e..48b4015 100644
--- a/arch/alpha/kernel/traps.c
+++ b/arch/alpha/kernel/traps.c
@@ -628,7 +628,7 @@ do_entUna(void * va, unsigned long opcod
got_exception:
/* Ok, we caught the exception, but we don't want it. Is there
someone to pass it along to? */
- if ((fixup = search_exception_tables(pc)) != 0) {
+ if ((fixup = search_exception_tables(pc)) != NULL) {
unsigned long newpc;
newpc = fixup_exception(una_reg, fixup, pc);
diff --git a/arch/alpha/mm/fault.c b/arch/alpha/mm/fault.c
index a0e18da..dffca85 100644
--- a/arch/alpha/mm/fault.c
+++ b/arch/alpha/mm/fault.c
@@ -171,7 +171,7 @@ #endif
no_context:
/* Are we prepared to handle this fault as an exception? */
- if ((fixup = search_exception_tables(regs->pc)) != 0) {
+ if ((fixup = search_exception_tables(regs->pc)) != NULL) {
unsigned long newpc;
newpc = fixup_exception(dpf_reg, fixup, regs->pc);
regs->pc = newpc;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]