diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2014-11-18 07:23:43 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2014-11-24 20:07:27 -0500 |
commit | fe0bf1185ddf7e9d193cfe397ed1414d91526e19 (patch) | |
tree | f8b2c40b78cfa1714e606e79ffc36363ece0dc8f /fs/nfs | |
parent | 1306729b0d4f4a0bd0d098711ed3d938dc5a1a28 (diff) |
NFS: Deletion of unnecessary checks before the function call "nfs_put_client"
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>
Diffstat (limited to 'fs/nfs')
-rw-r--r-- | fs/nfs/filelayout/filelayoutdev.c | 3 | ||||
-rw-r--r-- | fs/nfs/nfs4client.c | 15 |
2 files changed, 6 insertions, 12 deletions
diff --git a/fs/nfs/filelayout/filelayoutdev.c b/fs/nfs/filelayout/filelayoutdev.c index 9bb806a76d99..bfecac781f19 100644 --- a/fs/nfs/filelayout/filelayoutdev.c +++ b/fs/nfs/filelayout/filelayoutdev.c | |||
@@ -204,8 +204,7 @@ destroy_ds(struct nfs4_pnfs_ds *ds) | |||
204 | ifdebug(FACILITY) | 204 | ifdebug(FACILITY) |
205 | print_ds(ds); | 205 | print_ds(ds); |
206 | 206 | ||
207 | if (ds->ds_clp) | 207 | nfs_put_client(ds->ds_clp); |
208 | nfs_put_client(ds->ds_clp); | ||
209 | 208 | ||
210 | while (!list_empty(&ds->ds_addrs)) { | 209 | while (!list_empty(&ds->ds_addrs)) { |
211 | da = list_first_entry(&ds->ds_addrs, | 210 | da = list_first_entry(&ds->ds_addrs, |
diff --git a/fs/nfs/nfs4client.c b/fs/nfs/nfs4client.c index ffdb28d86cf8..5f07a0ed9188 100644 --- a/fs/nfs/nfs4client.c +++ b/fs/nfs/nfs4client.c | |||
@@ -498,8 +498,7 @@ int nfs40_walk_client_list(struct nfs_client *new, | |||
498 | atomic_inc(&pos->cl_count); | 498 | atomic_inc(&pos->cl_count); |
499 | spin_unlock(&nn->nfs_client_lock); | 499 | spin_unlock(&nn->nfs_client_lock); |
500 | 500 | ||
501 | if (prev) | 501 | nfs_put_client(prev); |
502 | nfs_put_client(prev); | ||
503 | prev = pos; | 502 | prev = pos; |
504 | 503 | ||
505 | status = nfs_wait_client_init_complete(pos); | 504 | status = nfs_wait_client_init_complete(pos); |
@@ -517,8 +516,7 @@ int nfs40_walk_client_list(struct nfs_client *new, | |||
517 | atomic_inc(&pos->cl_count); | 516 | atomic_inc(&pos->cl_count); |
518 | spin_unlock(&nn->nfs_client_lock); | 517 | spin_unlock(&nn->nfs_client_lock); |
519 | 518 | ||
520 | if (prev) | 519 | nfs_put_client(prev); |
521 | nfs_put_client(prev); | ||
522 | prev = pos; | 520 | prev = pos; |
523 | 521 | ||
524 | status = nfs4_proc_setclientid_confirm(pos, &clid, cred); | 522 | status = nfs4_proc_setclientid_confirm(pos, &clid, cred); |
@@ -549,8 +547,7 @@ int nfs40_walk_client_list(struct nfs_client *new, | |||
549 | 547 | ||
550 | /* No match found. The server lost our clientid */ | 548 | /* No match found. The server lost our clientid */ |
551 | out: | 549 | out: |
552 | if (prev) | 550 | nfs_put_client(prev); |
553 | nfs_put_client(prev); | ||
554 | dprintk("NFS: <-- %s status = %d\n", __func__, status); | 551 | dprintk("NFS: <-- %s status = %d\n", __func__, status); |
555 | return status; | 552 | return status; |
556 | } | 553 | } |
@@ -641,8 +638,7 @@ int nfs41_walk_client_list(struct nfs_client *new, | |||
641 | atomic_inc(&pos->cl_count); | 638 | atomic_inc(&pos->cl_count); |
642 | spin_unlock(&nn->nfs_client_lock); | 639 | spin_unlock(&nn->nfs_client_lock); |
643 | 640 | ||
644 | if (prev) | 641 | nfs_put_client(prev); |
645 | nfs_put_client(prev); | ||
646 | prev = pos; | 642 | prev = pos; |
647 | 643 | ||
648 | status = nfs_wait_client_init_complete(pos); | 644 | status = nfs_wait_client_init_complete(pos); |
@@ -675,8 +671,7 @@ int nfs41_walk_client_list(struct nfs_client *new, | |||
675 | /* No matching nfs_client found. */ | 671 | /* No matching nfs_client found. */ |
676 | spin_unlock(&nn->nfs_client_lock); | 672 | spin_unlock(&nn->nfs_client_lock); |
677 | dprintk("NFS: <-- %s status = %d\n", __func__, status); | 673 | dprintk("NFS: <-- %s status = %d\n", __func__, status); |
678 | if (prev) | 674 | nfs_put_client(prev); |
679 | nfs_put_client(prev); | ||
680 | return status; | 675 | return status; |
681 | } | 676 | } |
682 | #endif /* CONFIG_NFS_V4_1 */ | 677 | #endif /* CONFIG_NFS_V4_1 */ |