Skip to content

Commit fa1af75

Browse files
gregkhkees
authored andcommitted
pstore: 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: 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>
1 parent 1614e92 commit fa1af75

1 file changed

Lines changed: 2 additions & 16 deletions

File tree

fs/pstore/ftrace.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -112,27 +112,13 @@ static struct dentry *pstore_ftrace_dir;
112112

113113
void pstore_register_ftrace(void)
114114
{
115-
struct dentry *file;
116-
117115
if (!psinfo->write)
118116
return;
119117

120118
pstore_ftrace_dir = debugfs_create_dir("pstore", NULL);
121-
if (!pstore_ftrace_dir) {
122-
pr_err("%s: unable to create pstore directory\n", __func__);
123-
return;
124-
}
125-
126-
file = debugfs_create_file("record_ftrace", 0600, pstore_ftrace_dir,
127-
NULL, &pstore_knob_fops);
128-
if (!file) {
129-
pr_err("%s: unable to create record_ftrace file\n", __func__);
130-
goto err_file;
131-
}
132119

133-
return;
134-
err_file:
135-
debugfs_remove(pstore_ftrace_dir);
120+
debugfs_create_file("record_ftrace", 0600, pstore_ftrace_dir, NULL,
121+
&pstore_knob_fops);
136122
}
137123

138124
void pstore_unregister_ftrace(void)

0 commit comments

Comments
 (0)