Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Markus Elfring and committed by
Trond Myklebust
fe0bf118 1306729b

+6 -12
+1 -2
fs/nfs/filelayout/filelayoutdev.c
··· 204 204 ifdebug(FACILITY) 205 205 print_ds(ds); 206 206 207 - if (ds->ds_clp) 208 - nfs_put_client(ds->ds_clp); 207 + nfs_put_client(ds->ds_clp); 209 208 210 209 while (!list_empty(&ds->ds_addrs)) { 211 210 da = list_first_entry(&ds->ds_addrs,
+5 -10
fs/nfs/nfs4client.c
··· 498 498 atomic_inc(&pos->cl_count); 499 499 spin_unlock(&nn->nfs_client_lock); 500 500 501 - if (prev) 502 - nfs_put_client(prev); 501 + nfs_put_client(prev); 503 502 prev = pos; 504 503 505 504 status = nfs_wait_client_init_complete(pos); ··· 516 517 atomic_inc(&pos->cl_count); 517 518 spin_unlock(&nn->nfs_client_lock); 518 519 519 - if (prev) 520 - nfs_put_client(prev); 520 + nfs_put_client(prev); 521 521 prev = pos; 522 522 523 523 status = nfs4_proc_setclientid_confirm(pos, &clid, cred); ··· 547 549 548 550 /* No match found. The server lost our clientid */ 549 551 out: 550 - if (prev) 551 - nfs_put_client(prev); 552 + nfs_put_client(prev); 552 553 dprintk("NFS: <-- %s status = %d\n", __func__, status); 553 554 return status; 554 555 } ··· 638 641 atomic_inc(&pos->cl_count); 639 642 spin_unlock(&nn->nfs_client_lock); 640 643 641 - if (prev) 642 - nfs_put_client(prev); 644 + nfs_put_client(prev); 643 645 prev = pos; 644 646 645 647 status = nfs_wait_client_init_complete(pos); ··· 671 675 /* No matching nfs_client found. */ 672 676 spin_unlock(&nn->nfs_client_lock); 673 677 dprintk("NFS: <-- %s status = %d\n", __func__, status); 674 - if (prev) 675 - nfs_put_client(prev); 678 + nfs_put_client(prev); 676 679 return status; 677 680 } 678 681 #endif /* CONFIG_NFS_V4_1 */