Commit d8140426 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Paul Burton

mips: kernel: 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: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@mips.com>
Cc: James Hogan <jhogan@kernel.org>
Cc: Yangtao Li <tiny.windzz@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
Cc: Mathieu Malaterre <malat@debian.org>
Cc: Huacai Chen <chenhc@lemote.com>
Cc: Marcin Nowakowski <marcin.nowakowski@mips.com>
Cc: Yasha Cherikovsky <yasha.che3@gmail.com>
Cc: linux-mips@vger.kernel.org
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarPaul Burton <paul.burton@mips.com>
parent ef9d5a6a
...@@ -2351,23 +2351,10 @@ DEFINE_SHOW_ATTRIBUTE(mipsr2_clear); ...@@ -2351,23 +2351,10 @@ DEFINE_SHOW_ATTRIBUTE(mipsr2_clear);
static int __init mipsr2_init_debugfs(void) static int __init mipsr2_init_debugfs(void)
{ {
struct dentry *mipsr2_emul; debugfs_create_file("r2_emul_stats", S_IRUGO, mips_debugfs_dir, NULL,
&mipsr2_emul_fops);
if (!mips_debugfs_dir) debugfs_create_file("r2_emul_stats_clear", S_IRUGO, mips_debugfs_dir,
return -ENODEV; NULL, &mipsr2_clear_fops);
mipsr2_emul = debugfs_create_file("r2_emul_stats", S_IRUGO,
mips_debugfs_dir, NULL,
&mipsr2_emul_fops);
if (!mipsr2_emul)
return -ENOMEM;
mipsr2_emul = debugfs_create_file("r2_emul_stats_clear", S_IRUGO,
mips_debugfs_dir, NULL,
&mipsr2_clear_fops);
if (!mipsr2_emul)
return -ENOMEM;
return 0; return 0;
} }
......
...@@ -95,18 +95,9 @@ static const struct file_operations segments_fops = { ...@@ -95,18 +95,9 @@ static const struct file_operations segments_fops = {
static int __init segments_info(void) static int __init segments_info(void)
{ {
struct dentry *segments; if (cpu_has_segments)
debugfs_create_file("segments", S_IRUGO, mips_debugfs_dir, NULL,
if (cpu_has_segments) { &segments_fops);
if (!mips_debugfs_dir)
return -ENODEV;
segments = debugfs_create_file("segments", S_IRUGO,
mips_debugfs_dir, NULL,
&segments_fops);
if (!segments)
return -ENOMEM;
}
return 0; return 0;
} }
......
...@@ -1010,12 +1010,7 @@ unsigned long fw_passed_dtb; ...@@ -1010,12 +1010,7 @@ unsigned long fw_passed_dtb;
struct dentry *mips_debugfs_dir; struct dentry *mips_debugfs_dir;
static int __init debugfs_mips(void) static int __init debugfs_mips(void)
{ {
struct dentry *d; mips_debugfs_dir = debugfs_create_dir("mips", NULL);
d = debugfs_create_dir("mips", NULL);
if (!d)
return -ENOMEM;
mips_debugfs_dir = d;
return 0; return 0;
} }
arch_initcall(debugfs_mips); arch_initcall(debugfs_mips);
......
...@@ -118,23 +118,10 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_multi, multi_get, NULL, "%llu\n"); ...@@ -118,23 +118,10 @@ DEFINE_SIMPLE_ATTRIBUTE(fops_multi, multi_get, NULL, "%llu\n");
static int __init spinlock_test(void) static int __init spinlock_test(void)
{ {
struct dentry *d; debugfs_create_file("spin_single", S_IRUGO, mips_debugfs_dir, NULL,
&fops_ss);
if (!mips_debugfs_dir) debugfs_create_file("spin_multi", S_IRUGO, mips_debugfs_dir, NULL,
return -ENODEV; &fops_multi);
d = debugfs_create_file("spin_single", S_IRUGO,
mips_debugfs_dir, NULL,
&fops_ss);
if (!d)
return -ENOMEM;
d = debugfs_create_file("spin_multi", S_IRUGO,
mips_debugfs_dir, NULL,
&fops_multi);
if (!d)
return -ENOMEM;
return 0; return 0;
} }
device_initcall(spinlock_test); device_initcall(spinlock_test);
...@@ -2374,18 +2374,10 @@ asmlinkage void do_ade(struct pt_regs *regs) ...@@ -2374,18 +2374,10 @@ asmlinkage void do_ade(struct pt_regs *regs)
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
static int __init debugfs_unaligned(void) static int __init debugfs_unaligned(void)
{ {
struct dentry *d; debugfs_create_u32("unaligned_instructions", S_IRUGO, mips_debugfs_dir,
&unaligned_instructions);
if (!mips_debugfs_dir) debugfs_create_u32("unaligned_action", S_IRUGO | S_IWUSR,
return -ENODEV; mips_debugfs_dir, &unaligned_action);
d = debugfs_create_u32("unaligned_instructions", S_IRUGO,
mips_debugfs_dir, &unaligned_instructions);
if (!d)
return -ENOMEM;
d = debugfs_create_u32("unaligned_action", S_IRUGO | S_IWUSR,
mips_debugfs_dir, &unaligned_action);
if (!d)
return -ENOMEM;
return 0; return 0;
} }
arch_initcall(debugfs_unaligned); arch_initcall(debugfs_unaligned);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment