]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drivers:iio:Fix the NULL vs IS_ERR() bug for debugfs_create_dir()
authorYang Ruibin <11162571@vivo.com>
Wed, 21 Aug 2024 08:39:08 +0000 (04:39 -0400)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Wed, 21 Aug 2024 20:32:52 +0000 (21:32 +0100)
The debugfs_create_dir() function returns error pointers.
It never returns NULL. So use IS_ERR() to check it.

Signed-off-by: Yang Ruibin <11162571@vivo.com>
Link: https://patch.msgid.link/20240821083911.3411-1-11162571@vivo.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/industrialio-backend.c

index a52a6b61c8b57841b1cf893c7efc95cc5f699c1f..20b3b5212da76a311552c9cdbaa6daca7a98b4cd 100644 (file)
@@ -219,7 +219,7 @@ void iio_backend_debugfs_add(struct iio_backend *back,
        snprintf(name, sizeof(name), "backend%d", back->idx);
 
        back_d = debugfs_create_dir(name, d);
-       if (!back_d)
+       if (IS_ERR(back_d))
                return;
 
        if (back->ops->debugfs_reg_access)