Skip to content

Commit

Permalink
pstore: no need to check return value of debugfs_create functions
Browse files Browse the repository at this point in the history
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: Kees Cook <keescook@chromium.org>
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
  • Loading branch information
Greg Kroah-Hartman authored and Kees Cook committed Jul 9, 2019
1 parent 1614e92 commit fa1af75
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions fs/pstore/ftrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,27 +112,13 @@ static struct dentry *pstore_ftrace_dir;

void pstore_register_ftrace(void)
{
struct dentry *file;

if (!psinfo->write)
return;

pstore_ftrace_dir = debugfs_create_dir("pstore", NULL);
if (!pstore_ftrace_dir) {
pr_err("%s: unable to create pstore directory\n", __func__);
return;
}

file = debugfs_create_file("record_ftrace", 0600, pstore_ftrace_dir,
NULL, &pstore_knob_fops);
if (!file) {
pr_err("%s: unable to create record_ftrace file\n", __func__);
goto err_file;
}

return;
err_file:
debugfs_remove(pstore_ftrace_dir);
debugfs_create_file("record_ftrace", 0600, pstore_ftrace_dir, NULL,
&pstore_knob_fops);
}

void pstore_unregister_ftrace(void)
Expand Down

0 comments on commit fa1af75

Please sign in to comment.