Commit c20e57b3 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman Committed by Jaegeuk Kim

f2fs: no need to check return value of debugfs_create functions

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: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Chao Yu <yuchao0@huawei.com>
Cc: linux-f2fs-devel@lists.sourceforge.net
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 5d539245
...@@ -511,30 +511,16 @@ void f2fs_destroy_stats(struct f2fs_sb_info *sbi) ...@@ -511,30 +511,16 @@ void f2fs_destroy_stats(struct f2fs_sb_info *sbi)
kvfree(si); kvfree(si);
} }
int __init f2fs_create_root_stats(void) void __init f2fs_create_root_stats(void)
{ {
struct dentry *file;
f2fs_debugfs_root = debugfs_create_dir("f2fs", NULL); f2fs_debugfs_root = debugfs_create_dir("f2fs", NULL);
if (!f2fs_debugfs_root)
return -ENOMEM;
file = debugfs_create_file("status", S_IRUGO, f2fs_debugfs_root, debugfs_create_file("status", S_IRUGO, f2fs_debugfs_root, NULL,
NULL, &stat_fops); &stat_fops);
if (!file) {
debugfs_remove(f2fs_debugfs_root);
f2fs_debugfs_root = NULL;
return -ENOMEM;
}
return 0;
} }
void f2fs_destroy_root_stats(void) void f2fs_destroy_root_stats(void)
{ {
if (!f2fs_debugfs_root)
return;
debugfs_remove_recursive(f2fs_debugfs_root); debugfs_remove_recursive(f2fs_debugfs_root);
f2fs_debugfs_root = NULL; f2fs_debugfs_root = NULL;
} }
...@@ -3329,7 +3329,7 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi) ...@@ -3329,7 +3329,7 @@ static inline struct f2fs_stat_info *F2FS_STAT(struct f2fs_sb_info *sbi)
int f2fs_build_stats(struct f2fs_sb_info *sbi); int f2fs_build_stats(struct f2fs_sb_info *sbi);
void f2fs_destroy_stats(struct f2fs_sb_info *sbi); void f2fs_destroy_stats(struct f2fs_sb_info *sbi);
int __init f2fs_create_root_stats(void); void __init f2fs_create_root_stats(void);
void f2fs_destroy_root_stats(void); void f2fs_destroy_root_stats(void);
#else #else
#define stat_inc_cp_count(si) do { } while (0) #define stat_inc_cp_count(si) do { } while (0)
...@@ -3367,7 +3367,7 @@ void f2fs_destroy_root_stats(void); ...@@ -3367,7 +3367,7 @@ void f2fs_destroy_root_stats(void);
static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; } static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; }
static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { } static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { }
static inline int __init f2fs_create_root_stats(void) { return 0; } static inline void __init f2fs_create_root_stats(void) { }
static inline void f2fs_destroy_root_stats(void) { } static inline void f2fs_destroy_root_stats(void) { }
#endif #endif
......
...@@ -3550,9 +3550,7 @@ static int __init init_f2fs_fs(void) ...@@ -3550,9 +3550,7 @@ static int __init init_f2fs_fs(void)
err = register_filesystem(&f2fs_fs_type); err = register_filesystem(&f2fs_fs_type);
if (err) if (err)
goto free_shrinker; goto free_shrinker;
err = f2fs_create_root_stats(); f2fs_create_root_stats();
if (err)
goto free_filesystem;
err = f2fs_init_post_read_processing(); err = f2fs_init_post_read_processing();
if (err) if (err)
goto free_root_stats; goto free_root_stats;
...@@ -3560,7 +3558,6 @@ static int __init init_f2fs_fs(void) ...@@ -3560,7 +3558,6 @@ static int __init init_f2fs_fs(void)
free_root_stats: free_root_stats:
f2fs_destroy_root_stats(); f2fs_destroy_root_stats();
free_filesystem:
unregister_filesystem(&f2fs_fs_type); unregister_filesystem(&f2fs_fs_type);
free_shrinker: free_shrinker:
unregister_shrinker(&f2fs_shrinker_info); unregister_shrinker(&f2fs_shrinker_info);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment