macintosh/adb: Fix warning comparing pointer to 0
authorHaowen Bai <baihaowen@meizu.com>
Thu, 17 Mar 2022 02:35:54 +0000 (10:35 +0800)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 24 Nov 2022 12:12:17 +0000 (23:12 +1100)
Avoid pointer type value compared with 0 to make code clear.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/1647484554-13258-1-git-send-email-baihaowen@meizu.com
drivers/macintosh/adb.c

index 1bbb9ca08d40f8f1d0bf50e0d1e743a05de63352..23bd0c77ac1af3b279df00122e606364304057c5 100644 (file)
@@ -478,7 +478,7 @@ adb_register(int default_id, int handler_id, struct adb_ids *ids,
                if ((adb_handler[i].original_address == default_id) &&
                    (!handler_id || (handler_id == adb_handler[i].handler_id) || 
                    try_handler_change(i, handler_id))) {
-                       if (adb_handler[i].handler != 0) {
+                       if (adb_handler[i].handler) {
                                pr_err("Two handlers for ADB device %d\n",
                                       default_id);
                                continue;
@@ -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;
        }