Skip to contentSkip to conversation

macintosh/adb: 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/adb: Fix warning comparing pointer to 0

Fix the following coccicheck warning:

drivers/macintosh/adb.c:676:14-15: WARNING comparing pointer to 0.

---
 drivers/macintosh/adb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/macintosh/adb.c +1 -1
index 1bbb9ca08d40..076253599bd4 100644
@@ -673,7 +673,7 @@ static int adb_open(struct inode *inode, struct file *file)
 		goto out;
 	}
 	state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
-	if (state == 0) {
+	if (state) {
 		ret = -ENOMEM;
 		goto out;
 	}
Signature · 1 line
2.25.1
#1 lore raw

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

Quoted 14 lines

Fix the following coccicheck warning:

drivers/macintosh/adb.c:676:14-15: WARNING comparing pointer to 0.

---
  drivers/macintosh/adb.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/macintosh/adb.c +0 -0
index 1bbb9ca08d40..076253599bd4 100644

drivers/macintosh/adb.c static int adb_open(struct inode *inode, struct file *file) · line 676

Quoted 5 lines
drivers/macintosh/adb.c +1 -1
@@ -673,7 +673,7 @@ static int adb_open(struct inode *inode, struct file *file)
  		goto out;
  	}
  	state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
-	if (state == 0) {
+	if (state) {

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

CJ

Quoted 3 lines
drivers/macintosh/adb.c +0 -0
  		ret = -ENOMEM;
  		goto out;
  	}
#2 lore raw

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

Quoted 6 lines

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

Quoted 5 lines

Fix the following coccicheck warning:

drivers/macintosh/adb.c:676:14-15: 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 25 lines
Quoted 9 lines

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

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/macintosh/adb.c +0 -0
index 1bbb9ca08d40..076253599bd4 100644

drivers/macintosh/adb.c static int adb_open(struct inode *inode, struct · line 677

Quoted 6 lines
drivers/macintosh/adb.c +1 -1
@@ -673,7 +673,7 @@ static int adb_open(struct inode *inode, struct 
 file *file)
           goto out;
       }
       state = kmalloc(sizeof(struct adbdev_state), GFP_KERNEL);
-    if (state == 0) {
+    if (state) {

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

CJ

Quoted 3 lines
drivers/macintosh/adb.c +0 -0
           ret = -ENOMEM;
           goto out;

      }