Skip to content

Commit 15b6ff9

Browse files
committed
nfsd: 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: "J. Bruce Fields" <[email protected]> Cc: Jeff Layton <[email protected]> Cc: [email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 352bce2 commit 15b6ff9

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

fs/nfsd/fault_inject.c

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -127,24 +127,16 @@ static struct nfsd_fault_inject_op inject_ops[] = {
127127
},
128128
};
129129

130-
int nfsd_fault_inject_init(void)
130+
void nfsd_fault_inject_init(void)
131131
{
132132
unsigned int i;
133133
struct nfsd_fault_inject_op *op;
134134
umode_t mode = S_IFREG | S_IRUSR | S_IWUSR;
135135

136136
debug_dir = debugfs_create_dir("nfsd", NULL);
137-
if (!debug_dir)
138-
goto fail;
139137

140138
for (i = 0; i < ARRAY_SIZE(inject_ops); i++) {
141139
op = &inject_ops[i];
142-
if (!debugfs_create_file(op->file, mode, debug_dir, op, &fops_nfsd))
143-
goto fail;
140+
debugfs_create_file(op->file, mode, debug_dir, op, &fops_nfsd);
144141
}
145-
return 0;
146-
147-
fail:
148-
nfsd_fault_inject_cleanup();
149-
return -ENOMEM;
150142
}

fs/nfsd/nfsctl.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,9 +1291,7 @@ static int __init init_nfsd(void)
12911291
retval = nfsd4_init_pnfs();
12921292
if (retval)
12931293
goto out_free_slabs;
1294-
retval = nfsd_fault_inject_init(); /* nfsd fault injection controls */
1295-
if (retval)
1296-
goto out_exit_pnfs;
1294+
nfsd_fault_inject_init(); /* nfsd fault injection controls */
12971295
nfsd_stat_init(); /* Statistics */
12981296
retval = nfsd_reply_cache_init();
12991297
if (retval)
@@ -1315,7 +1313,6 @@ static int __init init_nfsd(void)
13151313
out_free_stat:
13161314
nfsd_stat_shutdown();
13171315
nfsd_fault_inject_cleanup();
1318-
out_exit_pnfs:
13191316
nfsd4_exit_pnfs();
13201317
out_free_slabs:
13211318
nfsd4_free_slabs();

fs/nfsd/state.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ extern void nfsd4_record_grace_done(struct nfsd_net *nn);
663663

664664
/* nfs fault injection functions */
665665
#ifdef CONFIG_NFSD_FAULT_INJECTION
666-
int nfsd_fault_inject_init(void);
666+
void nfsd_fault_inject_init(void);
667667
void nfsd_fault_inject_cleanup(void);
668668

669669
u64 nfsd_inject_print_clients(void);
@@ -684,7 +684,7 @@ u64 nfsd_inject_forget_delegations(u64);
684684
u64 nfsd_inject_recall_client_delegations(struct sockaddr_storage *, size_t);
685685
u64 nfsd_inject_recall_delegations(u64);
686686
#else /* CONFIG_NFSD_FAULT_INJECTION */
687-
static inline int nfsd_fault_inject_init(void) { return 0; }
687+
static inline void nfsd_fault_inject_init(void) {}
688688
static inline void nfsd_fault_inject_cleanup(void) {}
689689
#endif /* CONFIG_NFSD_FAULT_INJECTION */
690690

0 commit comments

Comments
 (0)