Skip to content

Commit 8788c6c

Browse files
Atul Kumar Pantingomolnar
authored andcommitted
locking/debug: Fix debugfs API return value checks to use IS_ERR()
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
1 parent cfa92b6 commit 8788c6c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

kernel/locking/lock_events.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static int __init init_lockevent_counts(void)
146146
struct dentry *d_counts = debugfs_create_dir(LOCK_EVENTS_DIR, NULL);
147147
int i;
148148

149-
if (!d_counts)
149+
if (IS_ERR(d_counts))
150150
goto out;
151151

152152
/*
@@ -159,14 +159,14 @@ static int __init init_lockevent_counts(void)
159159
for (i = 0; i < lockevent_num; i++) {
160160
if (skip_lockevent(lockevent_names[i]))
161161
continue;
162-
if (!debugfs_create_file(lockevent_names[i], 0400, d_counts,
163-
(void *)(long)i, &fops_lockevent))
162+
if (IS_ERR(debugfs_create_file(lockevent_names[i], 0400, d_counts,
163+
(void *)(long)i, &fops_lockevent)))
164164
goto fail_undo;
165165
}
166166

167-
if (!debugfs_create_file(lockevent_names[LOCKEVENT_reset_cnts], 0200,
167+
if (IS_ERR(debugfs_create_file(lockevent_names[LOCKEVENT_reset_cnts], 0200,
168168
d_counts, (void *)(long)LOCKEVENT_reset_cnts,
169-
&fops_lockevent))
169+
&fops_lockevent)))
170170
goto fail_undo;
171171

172172
return 0;

0 commit comments

Comments
 (0)