Skip to content

Commit a48f972

Browse files
gregkhteigland
authored andcommitted
dlm: 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. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: David Teigland <teigland@redhat.com>
1 parent b355516 commit a48f972

3 files changed

Lines changed: 7 additions & 27 deletions

File tree

‎fs/dlm/debug_fs.c‎

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ void dlm_delete_debug_file(struct dlm_ls *ls)
737737
debugfs_remove(ls->ls_debug_toss_dentry);
738738
}
739739

740-
int dlm_create_debug_file(struct dlm_ls *ls)
740+
void dlm_create_debug_file(struct dlm_ls *ls)
741741
{
742742
char name[DLM_LOCKSPACE_LEN + 8];
743743

@@ -748,8 +748,6 @@ int dlm_create_debug_file(struct dlm_ls *ls)
748748
dlm_root,
749749
ls,
750750
&format1_fops);
751-
if (!ls->ls_debug_rsb_dentry)
752-
goto fail;
753751

754752
/* format 2 */
755753

@@ -761,8 +759,6 @@ int dlm_create_debug_file(struct dlm_ls *ls)
761759
dlm_root,
762760
ls,
763761
&format2_fops);
764-
if (!ls->ls_debug_locks_dentry)
765-
goto fail;
766762

767763
/* format 3 */
768764

@@ -774,8 +770,6 @@ int dlm_create_debug_file(struct dlm_ls *ls)
774770
dlm_root,
775771
ls,
776772
&format3_fops);
777-
if (!ls->ls_debug_all_dentry)
778-
goto fail;
779773

780774
/* format 4 */
781775

@@ -787,8 +781,6 @@ int dlm_create_debug_file(struct dlm_ls *ls)
787781
dlm_root,
788782
ls,
789783
&format4_fops);
790-
if (!ls->ls_debug_toss_dentry)
791-
goto fail;
792784

793785
memset(name, 0, sizeof(name));
794786
snprintf(name, DLM_LOCKSPACE_LEN + 8, "%s_waiters", ls->ls_name);
@@ -798,21 +790,12 @@ int dlm_create_debug_file(struct dlm_ls *ls)
798790
dlm_root,
799791
ls,
800792
&waiters_fops);
801-
if (!ls->ls_debug_waiters_dentry)
802-
goto fail;
803-
804-
return 0;
805-
806-
fail:
807-
dlm_delete_debug_file(ls);
808-
return -ENOMEM;
809793
}
810794

811-
int __init dlm_register_debugfs(void)
795+
void __init dlm_register_debugfs(void)
812796
{
813797
mutex_init(&debug_buf_lock);
814798
dlm_root = debugfs_create_dir("dlm", NULL);
815-
return dlm_root ? 0 : -ENOMEM;
816799
}
817800

818801
void dlm_unregister_debugfs(void)

‎fs/dlm/dlm_internal.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -719,14 +719,14 @@ int dlm_plock_init(void);
719719
void dlm_plock_exit(void);
720720

721721
#ifdef CONFIG_DLM_DEBUG
722-
int dlm_register_debugfs(void);
722+
void dlm_register_debugfs(void);
723723
void dlm_unregister_debugfs(void);
724-
int dlm_create_debug_file(struct dlm_ls *ls);
724+
void dlm_create_debug_file(struct dlm_ls *ls);
725725
void dlm_delete_debug_file(struct dlm_ls *ls);
726726
#else
727-
static inline int dlm_register_debugfs(void) { return 0; }
727+
static inline void dlm_register_debugfs(void) { }
728728
static inline void dlm_unregister_debugfs(void) { }
729-
static inline int dlm_create_debug_file(struct dlm_ls *ls) { return 0; }
729+
static inline void dlm_create_debug_file(struct dlm_ls *ls) { }
730730
static inline void dlm_delete_debug_file(struct dlm_ls *ls) { }
731731
#endif
732732

‎fs/dlm/main.c‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ static int __init init_dlm(void)
3535
if (error)
3636
goto out_lockspace;
3737

38-
error = dlm_register_debugfs();
39-
if (error)
40-
goto out_config;
38+
dlm_register_debugfs();
4139

4240
error = dlm_user_init();
4341
if (error)
@@ -61,7 +59,6 @@ static int __init init_dlm(void)
6159
dlm_user_exit();
6260
out_debug:
6361
dlm_unregister_debugfs();
64-
out_config:
6562
dlm_config_exit();
6663
out_lockspace:
6764
dlm_lockspace_exit();

0 commit comments

Comments
 (0)