History

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.

Greg Kroah-Hartman committed 7 years ago

Commit fecb0d91 parent d1fdb6d1 file · +2 −12Browse files

Unified · Split

lib/debugobjects.c+2−12
@@ -850,26 +850,16 @@ static const struct file_operations debug_stats_fops = { · 849 unmodified lines
850 850
851static int __init debug_objects_init_debugfs(void)851static int __init debug_objects_init_debugfs(void)
852{852{
853 struct dentry *dbgdir, *dbgstats;853 struct dentry *dbgdir;
854 854
855 if (!debug_objects_enabled)855 if (!debug_objects_enabled)
856 return 0;856 return 0;
857 857
858 dbgdir = debugfs_create_dir("debug_objects", NULL);858 dbgdir = debugfs_create_dir("debug_objects", NULL);
859 if (!dbgdir)
860 return -ENOMEM;
861 859
862 dbgstats = debugfs_create_file("stats", 0444, dbgdir, NULL,860 debugfs_create_file("stats", 0444, dbgdir, NULL, &debug_stats_fops);
863 &debug_stats_fops);
864 if (!dbgstats)
865 goto err;
866 861
867 return 0;862 return 0;
868
869err:
870 debugfs_remove(dbgdir);
871
872 return -ENOMEM;
873}863}
874__initcall(debug_objects_init_debugfs);864__initcall(debug_objects_init_debugfs);
875 865