]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
locking/debug: Fix debugfs API return value checks to use IS_ERR()
authorAtul Kumar Pant <atulpant.linux@gmail.com>
Mon, 7 Aug 2023 12:18:34 +0000 (17:48 +0530)
committerIngo Molnar <mingo@kernel.org>
Tue, 3 Oct 2023 08:11:25 +0000 (10:11 +0200)
Update the checking of return values from debugfs_create_file()
and debugfs_create_dir() to use IS_ERR().

Signed-off-by: Atul Kumar Pant <atulpant.linux@gmail.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Acked-by: Waiman Long <longman@redhat.com>
Link: https://lore.kernel.org/r/20230807121834.7438-1-atulpant.linux@gmail.com
kernel/locking/lock_events.c

index fa2c2f951c6b5f8571cd576c2012c57ddd46dbb2..e68d820995580946110b2dcd00f12fb9064cfa77 100644 (file)
@@ -146,7 +146,7 @@ static int __init init_lockevent_counts(void)
        struct dentry *d_counts = debugfs_create_dir(LOCK_EVENTS_DIR, NULL);
        int i;
 
-       if (!d_counts)
+       if (IS_ERR(d_counts))
                goto out;
 
        /*
@@ -159,14 +159,14 @@ static int __init init_lockevent_counts(void)
        for (i = 0; i < lockevent_num; i++) {
                if (skip_lockevent(lockevent_names[i]))
                        continue;
-               if (!debugfs_create_file(lockevent_names[i], 0400, d_counts,
-                                        (void *)(long)i, &fops_lockevent))
+               if (IS_ERR(debugfs_create_file(lockevent_names[i], 0400, d_counts,
+                                        (void *)(long)i, &fops_lockevent)))
                        goto fail_undo;
        }
 
-       if (!debugfs_create_file(lockevent_names[LOCKEVENT_reset_cnts], 0200,
+       if (IS_ERR(debugfs_create_file(lockevent_names[LOCKEVENT_reset_cnts], 0200,
                                 d_counts, (void *)(long)LOCKEVENT_reset_cnts,
-                                &fops_lockevent))
+                                &fops_lockevent)))
                goto fail_undo;
 
        return 0;