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