Skip to content

Commit fecb0d9

Browse files
gregkhKAGA-KOKO
authored andcommitted
debugobjects: No need to check return value of debugfs_create()
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 <gregkh@linuxfoundation.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Qian Cai <cai@gmx.us> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Waiman Long <longman@redhat.com> Cc: "Joel Fernandes (Google)" <joel@joelfernandes.org> Cc: Zhong Jiang <zhongjiang@huawei.com> Link: https://lkml.kernel.org/r/20190612153513.GA21082@kroah.com
1 parent d1fdb6d commit fecb0d9

1 file changed

Lines changed: 2 additions & 12 deletions

File tree

‎lib/debugobjects.c‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -850,26 +850,16 @@ static const struct file_operations debug_stats_fops = {
850850

851851
static int __init debug_objects_init_debugfs(void)
852852
{
853-
struct dentry *dbgdir, *dbgstats;
853+
struct dentry *dbgdir;
854854

855855
if (!debug_objects_enabled)
856856
return 0;
857857

858858
dbgdir = debugfs_create_dir("debug_objects", NULL);
859-
if (!dbgdir)
860-
return -ENOMEM;
861859

862-
dbgstats = debugfs_create_file("stats", 0444, dbgdir, NULL,
863-
&debug_stats_fops);
864-
if (!dbgstats)
865-
goto err;
860+
debugfs_create_file("stats", 0444, dbgdir, NULL, &debug_stats_fops);
866861

867862
return 0;
868-
869-
err:
870-
debugfs_remove(dbgdir);
871-
872-
return -ENOMEM;
873863
}
874864
__initcall(debug_objects_init_debugfs);
875865

0 commit comments

Comments
 (0)