Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>
Reviewed-by: Chao Yu <yuchao0@huawei.com>
Cc: linux-f2fs-devel@lists.sourceforge.net
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+6 -23
+3 -17
fs/f2fs/debug.c
··· 506 506 kvfree(si); 507 507 } 508 508 509 - int __init f2fs_create_root_stats(void) 509 + void __init f2fs_create_root_stats(void) 510 510 { 511 - struct dentry *file; 512 - 513 511 f2fs_debugfs_root = debugfs_create_dir("f2fs", NULL); 514 - if (!f2fs_debugfs_root) 515 - return -ENOMEM; 516 512 517 - file = debugfs_create_file("status", S_IRUGO, f2fs_debugfs_root, 518 - NULL, &stat_fops); 519 - if (!file) { 520 - debugfs_remove(f2fs_debugfs_root); 521 - f2fs_debugfs_root = NULL; 522 - return -ENOMEM; 523 - } 524 - 525 - return 0; 513 + debugfs_create_file("status", S_IRUGO, f2fs_debugfs_root, NULL, 514 + &stat_fops); 526 515 } 527 516 528 517 void f2fs_destroy_root_stats(void) 529 518 { 530 - if (!f2fs_debugfs_root) 531 - return; 532 - 533 519 debugfs_remove_recursive(f2fs_debugfs_root); 534 520 f2fs_debugfs_root = NULL; 535 521 }
+2 -2
fs/f2fs/f2fs.h
··· 3328 3328 3329 3329 int f2fs_build_stats(struct f2fs_sb_info *sbi); 3330 3330 void f2fs_destroy_stats(struct f2fs_sb_info *sbi); 3331 - int __init f2fs_create_root_stats(void); 3331 + void __init f2fs_create_root_stats(void); 3332 3332 void f2fs_destroy_root_stats(void); 3333 3333 #else 3334 3334 #define stat_inc_cp_count(si) do { } while (0) ··· 3366 3366 3367 3367 static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; } 3368 3368 static inline void f2fs_destroy_stats(struct f2fs_sb_info *sbi) { } 3369 - static inline int __init f2fs_create_root_stats(void) { return 0; } 3369 + static inline void __init f2fs_create_root_stats(void) { } 3370 3370 static inline void f2fs_destroy_root_stats(void) { } 3371 3371 #endif 3372 3372
+1 -4
fs/f2fs/super.c
··· 3545 3545 err = register_filesystem(&f2fs_fs_type); 3546 3546 if (err) 3547 3547 goto free_shrinker; 3548 - err = f2fs_create_root_stats(); 3549 - if (err) 3550 - goto free_filesystem; 3548 + f2fs_create_root_stats(); 3551 3549 err = f2fs_init_post_read_processing(); 3552 3550 if (err) 3553 3551 goto free_root_stats; ··· 3553 3555 3554 3556 free_root_stats: 3555 3557 f2fs_destroy_root_stats(); 3556 - free_filesystem: 3557 3558 unregister_filesystem(&f2fs_fs_type); 3558 3559 free_shrinker: 3559 3560 unregister_shrinker(&f2fs_shrinker_info);