Skip to content

Commit

Permalink
debugobjects: No need to check return value of debugfs_create()
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.

Signed-off-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Qian Cai <[email protected]>
Cc: Andrew Morton <[email protected]>
Cc: Waiman Long <[email protected]>
Cc: "Joel Fernandes (Google)" <[email protected]>
Cc: Zhong Jiang <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
  • Loading branch information
gregkh authored and KAGA-KOKO committed Jun 14, 2019
1 parent d1fdb6d commit fecb0d9
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions lib/debugobjects.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,26 +850,16 @@ static const struct file_operations debug_stats_fops = {

static int __init debug_objects_init_debugfs(void)
{
struct dentry *dbgdir, *dbgstats;
struct dentry *dbgdir;

if (!debug_objects_enabled)
return 0;

dbgdir = debugfs_create_dir("debug_objects", NULL);
if (!dbgdir)
return -ENOMEM;

dbgstats = debugfs_create_file("stats", 0444, dbgdir, NULL,
&debug_stats_fops);
if (!dbgstats)
goto err;
debugfs_create_file("stats", 0444, dbgdir, NULL, &debug_stats_fops);

return 0;

err:
debugfs_remove(dbgdir);

return -ENOMEM;
}
__initcall(debug_objects_init_debugfs);

Expand Down

0 comments on commit fecb0d9

Please sign in to comment.