Skip to content

Commit

Permalink
mips: math-emu: no need to check return value of debugfs_create funct…
Browse files Browse the repository at this point in the history
…ions

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: linux-mips@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Burton <paul.burton@mips.com>
  • Loading branch information
Greg Kroah-Hartman authored and Paul Burton committed Jan 22, 2019
1 parent 864cc36 commit ef9d5a6
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions arch/mips/math-emu/me-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -189,32 +189,21 @@ static int __init debugfs_fpuemu(void)
{
struct dentry *fpuemu_debugfs_base_dir;
struct dentry *fpuemu_debugfs_inst_dir;
struct dentry *d, *reset_file;

if (!mips_debugfs_dir)
return -ENODEV;

fpuemu_debugfs_base_dir = debugfs_create_dir("fpuemustats",
mips_debugfs_dir);
if (!fpuemu_debugfs_base_dir)
return -ENOMEM;

reset_file = debugfs_create_file("fpuemustats_clear", 0444,
mips_debugfs_dir, NULL,
&fpuemustats_clear_fops);
if (!reset_file)
return -ENOMEM;
debugfs_create_file("fpuemustats_clear", 0444, mips_debugfs_dir, NULL,
&fpuemustats_clear_fops);

#define FPU_EMU_STAT_OFFSET(m) \
offsetof(struct mips_fpu_emulator_stats, m)

#define FPU_STAT_CREATE(m) \
do { \
d = debugfs_create_file(#m, 0444, fpuemu_debugfs_base_dir, \
debugfs_create_file(#m, 0444, fpuemu_debugfs_base_dir, \
(void *)FPU_EMU_STAT_OFFSET(m), \
&fops_fpuemu_stat); \
if (!d) \
return -ENOMEM; \
} while (0)

FPU_STAT_CREATE(emulated);
Expand All @@ -233,20 +222,16 @@ do { \

fpuemu_debugfs_inst_dir = debugfs_create_dir("instructions",
fpuemu_debugfs_base_dir);
if (!fpuemu_debugfs_inst_dir)
return -ENOMEM;

#define FPU_STAT_CREATE_EX(m) \
do { \
char name[32]; \
\
adjust_instruction_counter_name(name, #m); \
\
d = debugfs_create_file(name, 0444, fpuemu_debugfs_inst_dir, \
debugfs_create_file(name, 0444, fpuemu_debugfs_inst_dir, \
(void *)FPU_EMU_STAT_OFFSET(m), \
&fops_fpuemu_stat); \
if (!d) \
return -ENOMEM; \
} while (0)

FPU_STAT_CREATE_EX(abs_s);
Expand Down

0 comments on commit ef9d5a6

Please sign in to comment.