Skip to contentSkip to conversation

macintosh: Fix warning comparing pointer to 0

PATCH In review [email protected] 3 participants 3 messages Nov 6, 2022 Linux for power macintosh

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 macintosh: Fix warning comparing pointer to 0

Fix the following coccicheck warning:

drivers/macintosh/macio-adb.c:103:13-14: WARNING comparing pointer to 0.

---
 drivers/macintosh/macio-adb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/macintosh/macio-adb.c +1 -1
index 9b63bd2551c6..1c1c375a817d 100644
@@ -100,7 +100,7 @@ int macio_init(void)
 	unsigned int irq;
 
 	adbs = of_find_compatible_node(NULL, "adb", "chrp,adb0");
-	if (adbs == 0)
+	if (adbs)
 		return -ENXIO;
 
 	if (of_address_to_resource(adbs, 0, &r)) {
Signature · 1 line
2.25.1
#1 lore raw

Le 06/11/2022 à 16:18, [email protected] a écrit :

Quoted 14 lines

Fix the following coccicheck warning:

drivers/macintosh/macio-adb.c:103:13-14: WARNING comparing pointer to 0.

---
  drivers/macintosh/macio-adb.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/macintosh/macio-adb.c +0 -0
index 9b63bd2551c6..1c1c375a817d 100644

drivers/macintosh/macio-adb.c int macio_init(void) · line 103

Quoted 5 lines
drivers/macintosh/macio-adb.c +1 -1
@@ -100,7 +100,7 @@ int macio_init(void)
  	unsigned int irq;
 
  	adbs = of_find_compatible_node(NULL, "adb", "chrp,adb0");
-	if (adbs == 0)
+	if (adbs)

Hi
no, this should be "if (!adbs)"

CJ

Quoted 3 lines
drivers/macintosh/macio-adb.c +0 -0
  		return -ENXIO;
 
  	if (of_address_to_resource(adbs, 0, &r)) {
#2 lore raw

Le 06/11/2022 à 17:08, Christophe JAILLET a écrit :

Quoted 6 lines

Le 06/11/2022 à 16:18, [email protected] a écrit :

Quoted 5 lines

Fix the following coccicheck warning:

drivers/macintosh/macio-adb.c:103:13-14: WARNING comparing pointer to 0.

We already have such patches awaiting for application, see
https://patchwork.ozlabs.org/project/linuxppc-dev/list/?submitter=83647

Please check patchwork before submitting such fixes as they may already exist.

Thanks
Christophe

Quoted 23 lines
Quoted 10 lines

---
  drivers/macintosh/macio-adb.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/macintosh/macio-adb.c +0 -0
index 9b63bd2551c6..1c1c375a817d 100644

drivers/macintosh/macio-adb.c int macio_init(void) · line 102

Quoted 4 lines
drivers/macintosh/macio-adb.c +1 -1
@@ -100,7 +100,7 @@ int macio_init(void)
       unsigned int irq;
       adbs = of_find_compatible_node(NULL, "adb", "chrp,adb0");
-    if (adbs == 0)
+    if (adbs)

Hi
no, this should be "if (!adbs)"

CJ

Quoted 2 lines
drivers/macintosh/macio-adb.c +0 -0
           return -ENXIO;
       if (of_address_to_resource(adbs, 0, &r)) {