]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
lib: fix the NULL vs IS_ERR() bug for debugfs_create_dir()
authorYang Ruibin <11162571@vivo.com>
Wed, 21 Aug 2024 07:34:40 +0000 (03:34 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Mon, 2 Sep 2024 03:43:40 +0000 (20:43 -0700)
debugfs_create_dir() returns error pointers.  It never returns NULL.  So
use IS_ERR() to check it.

Link: https://lkml.kernel.org/r/20240821073441.9701-1-11162571@vivo.com
Signed-off-by: Yang Ruibin <11162571@vivo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
lib/test_fpu_glue.c

index 074f30301f2999de59294dc18e4a6a604a250f22..c0596426370a4d30522fb656fad540205893bc87 100644 (file)
@@ -42,7 +42,7 @@ static int __init test_fpu_init(void)
                return -EINVAL;
 
        selftest_dir = debugfs_create_dir("selftest_helpers", NULL);
-       if (!selftest_dir)
+       if (IS_ERR(selftest_dir))
                return -ENOMEM;
 
        debugfs_create_file_unsafe("test_fpu", 0444, selftest_dir, NULL,