NFS: Deletion of unnecessary checks before the function call "nfs_put_client"
authorMarkus Elfring <elfring@users.sourceforge.net>
Tue, 18 Nov 2014 12:23:43 +0000 (13:23 +0100)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Tue, 25 Nov 2014 01:07:27 +0000 (20:07 -0500)
The nfs_put_client() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/filelayout/filelayoutdev.c
fs/nfs/nfs4client.c

index 9bb806a76d9941daeb3af04609dfb0065255810c..bfecac781f199329f0f055b64c3a65ee5ef404e8 100644 (file)
@@ -204,8 +204,7 @@ destroy_ds(struct nfs4_pnfs_ds *ds)
        ifdebug(FACILITY)
                print_ds(ds);
 
-       if (ds->ds_clp)
-               nfs_put_client(ds->ds_clp);
+       nfs_put_client(ds->ds_clp);
 
        while (!list_empty(&ds->ds_addrs)) {
                da = list_first_entry(&ds->ds_addrs,
index ffdb28d86cf81636e22d6e2899a677fc967772d2..5f07a0ed9188efbddd6e57cecf64cddb6fc4b1c4 100644 (file)
@@ -498,8 +498,7 @@ int nfs40_walk_client_list(struct nfs_client *new,
                        atomic_inc(&pos->cl_count);
                        spin_unlock(&nn->nfs_client_lock);
 
-                       if (prev)
-                               nfs_put_client(prev);
+                       nfs_put_client(prev);
                        prev = pos;
 
                        status = nfs_wait_client_init_complete(pos);
@@ -517,8 +516,7 @@ int nfs40_walk_client_list(struct nfs_client *new,
                atomic_inc(&pos->cl_count);
                spin_unlock(&nn->nfs_client_lock);
 
-               if (prev)
-                       nfs_put_client(prev);
+               nfs_put_client(prev);
                prev = pos;
 
                status = nfs4_proc_setclientid_confirm(pos, &clid, cred);
@@ -549,8 +547,7 @@ int nfs40_walk_client_list(struct nfs_client *new,
 
        /* No match found. The server lost our clientid */
 out:
-       if (prev)
-               nfs_put_client(prev);
+       nfs_put_client(prev);
        dprintk("NFS: <-- %s status = %d\n", __func__, status);
        return status;
 }
@@ -641,8 +638,7 @@ int nfs41_walk_client_list(struct nfs_client *new,
                        atomic_inc(&pos->cl_count);
                        spin_unlock(&nn->nfs_client_lock);
 
-                       if (prev)
-                               nfs_put_client(prev);
+                       nfs_put_client(prev);
                        prev = pos;
 
                        status = nfs_wait_client_init_complete(pos);
@@ -675,8 +671,7 @@ int nfs41_walk_client_list(struct nfs_client *new,
        /* No matching nfs_client found. */
        spin_unlock(&nn->nfs_client_lock);
        dprintk("NFS: <-- %s status = %d\n", __func__, status);
-       if (prev)
-               nfs_put_client(prev);
+       nfs_put_client(prev);
        return status;
 }
 #endif /* CONFIG_NFS_V4_1 */