Skip to contentSkip to conversation

0 -> NULL, for arch/sparc

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

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

PATCH 16/68 0 -> NULL, for arch/sparc

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/ioport.c |    6 +++---
 kernel/pcic.c   |    2 +-
 kernel/prom.c   |    2 +-
 prom/bootstr.c  |    2 +-
 prom/tree.c     |    2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)
arch/sparc/kernel/ioport.c +3 -3
index 62182d2..3f1a8e2 100644
@@ -181,7 +181,7 @@ static void __iomem *_sparc_alloc_io(uns
 
 	if (name = NULL) name = "???";
 
-	if ((xres = xres_alloc()) != 0) {
+	if ((xres = xres_alloc()) != NULL) {
 		tack = xres->xname;
 		res = &xres->xres;
 	} else {
@@ -835,7 +835,7 @@ _sparc_io_get_info(char *buf, char **sta
 	for (r = ((struct resource *)data)->child; r != NULL; r = r->sibling) {
 		if (p + 32 >= e)	/* Better than nothing */
 			break;
-		if ((nm = r->name) = 0) nm = "???";
+		if ((nm = r->name) = NULL) nm = "???";
 		p += sprintf(p, "%016llx-%016llx: %s\n",
 				(unsigned long long)r->start,
 				(unsigned long long)r->end, nm);
@@ -858,7 +858,7 @@ _sparc_find_resource(struct resource *ro
 {
         struct resource *tmp;
 
-	for (tmp = root->child; tmp != 0; tmp = tmp->sibling) {
+	for (tmp = root->child; tmp != NULL; tmp = tmp->sibling) {
 		if (tmp->start <= hit && tmp->end >= hit)
 			return tmp;
 	}
arch/sparc/kernel/pcic.c +1 -1
index f2eae45..eace6e5 100644
@@ -540,7 +540,7 @@ pcic_fill_irq(struct linux_pcic *pcic, s
 		prom_getstring(node, "name", namebuf, sizeof(namebuf));
 	}
 
-	if ((p = pcic->pcic_imap) = 0) {
+	if ((p = pcic->pcic_imap) = NULL) {
 		dev->irq = 0;
 		return;
 	}
arch/sparc/kernel/prom.c +1 -1
index e3a5376..b5ab1a6 100644
@@ -33,7 +33,7 @@ struct device_node *of_find_node_by_phan
 {
 	struct device_node *np;
 
-	for (np = allnodes; np != 0; np = np->allnext)
+	for (np = allnodes; np != NULL; np = np->allnext)
 		if (np->node = handle)
 			break;
 
arch/sparc/prom/bootstr.c +1 -1
index cfdeac2..1f850b9 100644
@@ -33,7 +33,7 @@ prom_getbootargs(void)
 		/* Start from 1 and go over fd(0,0,0)kernel */
 		for(iter = 1; iter < 8; iter++) {
 			arg = (*(romvec->pv_v0bootargs))->argv[iter];
-			if(arg = 0) break;
+			if(arg = NULL) break;
 			while(*arg != 0) {
 				/* Leave place for space and null. */
 				if(cp >= barg_buf + BARG_LEN-2){
arch/sparc/prom/tree.c +1 -1
index 5ec2465..782be75 100644
@@ -309,7 +309,7 @@ int prom_setprop(int node, char *pname, 
 	int ret;
 
 	if(size = 0) return 0;
-	if((pname = 0) || (value = 0)) return 0;
+	if((pname = NULL) || (value = NULL)) return 0;
 	spin_lock_irqsave(&prom_lock, flags);
 	ret = prom_nodeops->no_setprop(node, pname, value, size);
 	restore_current();