Skip to content

Commit 5a2338d

Browse files
committed
lkdtm: no need to check return value of debugfs_create functions
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Arnd Bergmann <arnd@arndb.de> Cc: linux-kernel@vger.kernel.org Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 225afca commit 5a2338d

1 file changed

Lines changed: 2 additions & 11 deletions

File tree

‎drivers/misc/lkdtm/core.c‎

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -429,22 +429,13 @@ static int __init lkdtm_module_init(void)
429429

430430
/* Register debugfs interface */
431431
lkdtm_debugfs_root = debugfs_create_dir("provoke-crash", NULL);
432-
if (!lkdtm_debugfs_root) {
433-
pr_err("creating root dir failed\n");
434-
return -ENODEV;
435-
}
436432

437433
/* Install debugfs trigger files. */
438434
for (i = 0; i < ARRAY_SIZE(crashpoints); i++) {
439435
struct crashpoint *cur = &crashpoints[i];
440-
struct dentry *de;
441436

442-
de = debugfs_create_file(cur->name, 0644, lkdtm_debugfs_root,
443-
cur, &cur->fops);
444-
if (de == NULL) {
445-
pr_err("could not create crashpoint %s\n", cur->name);
446-
goto out_err;
447-
}
437+
debugfs_create_file(cur->name, 0644, lkdtm_debugfs_root, cur,
438+
&cur->fops);
448439
}
449440

450441
/* Install crashpoint if one was selected. */

0 commit comments

Comments
 (0)