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>
This commit is contained in:
Greg Kroah-Hartman 2019-06-11 20:32:13 +02:00
parent 225afca60b
commit 5a2338dbf9
1 changed files with 2 additions and 11 deletions

View File

@ -429,22 +429,13 @@ static int __init lkdtm_module_init(void)
/* Register debugfs interface */ /* Register debugfs interface */
lkdtm_debugfs_root = debugfs_create_dir("provoke-crash", NULL); lkdtm_debugfs_root = debugfs_create_dir("provoke-crash", NULL);
if (!lkdtm_debugfs_root) {
pr_err("creating root dir failed\n");
return -ENODEV;
}
/* Install debugfs trigger files. */ /* Install debugfs trigger files. */
for (i = 0; i < ARRAY_SIZE(crashpoints); i++) { for (i = 0; i < ARRAY_SIZE(crashpoints); i++) {
struct crashpoint *cur = &crashpoints[i]; struct crashpoint *cur = &crashpoints[i];
struct dentry *de;
de = debugfs_create_file(cur->name, 0644, lkdtm_debugfs_root, debugfs_create_file(cur->name, 0644, lkdtm_debugfs_root, cur,
cur, &cur->fops); &cur->fops);
if (de == NULL) {
pr_err("could not create crashpoint %s\n", cur->name);
goto out_err;
}
} }
/* Install crashpoint if one was selected. */ /* Install crashpoint if one was selected. */