Skip to contentSkip to conversation

0 -> NULL, for arch/xtensa

PATCH Applied Yoann Padioleau 1 participant 1 message Jul 27, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 20/68 0 -> NULL, for arch/xtensa

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

---

 kernel/pci.c           |    2 +-
 kernel/traps.c         |    2 +-
 platform-iss/console.c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
arch/xtensa/kernel/pci.c +1 -1
index 77deae5..1102816 100644
@@ -306,7 +306,7 @@ __pci_mmap_make_offset(struct pci_dev *d
 	unsigned long io_offset = 0;
 	int i, res_bit;
 
-	if (pci_ctrl = 0)
+	if (pci_ctrl = NULL)
 		return -EINVAL;		/* should never happen */
 
 	/* If memory, add on the PCI bridge address offset */
arch/xtensa/kernel/traps.c +1 -1
index c5e62f9..eb21c7c 100644
@@ -419,7 +419,7 @@ void show_stack(struct task_struct *task
 	int i = 0;
 	unsigned long *stack;
 
-	if (sp = 0)
+	if (sp = NULL)
 		__asm__ __volatile__ ("mov %0, a1\n" : "=a"(sp));
 
  	stack = sp;
arch/xtensa/platform-iss/console.c +1 -1
index 2f4f20f..ad8d65e 100644
@@ -265,7 +265,7 @@ static void iss_console_write(struct con
 {
 	int len = strlen(s);
 
-	if (s != 0 && *s != 0)
+	if (s != NULL && *s != 0)
 		__simc (SYS_write, 1, (unsigned long)s,
 			count < len ? count : len,0,0);
 }