nfsd: no need to check return value of debugfs_create functions
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Jun 2019 15:26:03 +0000 (17:26 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Jul 2019 14:57:17 +0000 (16:57 +0200)
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" <bfields@fieldses.org>
Cc: Jeff Layton <jlayton@kernel.org>
Cc: linux-nfs@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20190612152603.GB18440@kroah.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/fault_inject.c
fs/nfsd/nfsctl.c
fs/nfsd/state.h

index 84831253203dda4a4926db4a532098ffee8a1f4c..76bee0a0d3087f3c7db87d5c8619558455e33764 100644 (file)
@@ -127,24 +127,16 @@ static struct nfsd_fault_inject_op inject_ops[] = {
        },
 };
 
-int nfsd_fault_inject_init(void)
+void nfsd_fault_inject_init(void)
 {
        unsigned int i;
        struct nfsd_fault_inject_op *op;
        umode_t mode = S_IFREG | S_IRUSR | S_IWUSR;
 
        debug_dir = debugfs_create_dir("nfsd", NULL);
-       if (!debug_dir)
-               goto fail;
 
        for (i = 0; i < ARRAY_SIZE(inject_ops); i++) {
                op = &inject_ops[i];
-               if (!debugfs_create_file(op->file, mode, debug_dir, op, &fops_nfsd))
-                       goto fail;
+               debugfs_create_file(op->file, mode, debug_dir, op, &fops_nfsd);
        }
-       return 0;
-
-fail:
-       nfsd_fault_inject_cleanup();
-       return -ENOMEM;
 }
index 62c58cfeb8d899711b1b98a552c4017e909a4c62..6a9de59d9633ed26feefc7494ea7549809ac2a60 100644 (file)
@@ -1291,9 +1291,7 @@ static int __init init_nfsd(void)
        retval = nfsd4_init_pnfs();
        if (retval)
                goto out_free_slabs;
-       retval = nfsd_fault_inject_init(); /* nfsd fault injection controls */
-       if (retval)
-               goto out_exit_pnfs;
+       nfsd_fault_inject_init(); /* nfsd fault injection controls */
        nfsd_stat_init();       /* Statistics */
        retval = nfsd_reply_cache_init();
        if (retval)
@@ -1315,7 +1313,6 @@ out_free_lockd:
 out_free_stat:
        nfsd_stat_shutdown();
        nfsd_fault_inject_cleanup();
-out_exit_pnfs:
        nfsd4_exit_pnfs();
 out_free_slabs:
        nfsd4_free_slabs();
index 0b74d371ed670076a22da2f5bab6d9581e542ac3..87f310c78e06af3d36ef1d6a30991cf33fb706f1 100644 (file)
@@ -663,7 +663,7 @@ extern void nfsd4_record_grace_done(struct nfsd_net *nn);
 
 /* nfs fault injection functions */
 #ifdef CONFIG_NFSD_FAULT_INJECTION
-int nfsd_fault_inject_init(void);
+void nfsd_fault_inject_init(void);
 void nfsd_fault_inject_cleanup(void);
 
 u64 nfsd_inject_print_clients(void);
@@ -684,7 +684,7 @@ u64 nfsd_inject_forget_delegations(u64);
 u64 nfsd_inject_recall_client_delegations(struct sockaddr_storage *, size_t);
 u64 nfsd_inject_recall_delegations(u64);
 #else /* CONFIG_NFSD_FAULT_INJECTION */
-static inline int nfsd_fault_inject_init(void) { return 0; }
+static inline void nfsd_fault_inject_init(void) {}
 static inline void nfsd_fault_inject_cleanup(void) {}
 #endif /* CONFIG_NFSD_FAULT_INJECTION */