lustre: Deletion of unnecessary checks before three function calls
authorMarkus Elfring <elfring@users.sourceforge.net>
Tue, 2 Dec 2014 10:40:33 +0000 (11:40 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Dec 2014 00:52:37 +0000 (16:52 -0800)
The functions free_ll_remote_perm(), free_rmtperm_hash() and iput() test
whether their argument is NULL and then return immediately.
Thus the test around their calls is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/lustre/lustre/llite/remote_perm.c
drivers/staging/lustre/lustre/llite/statahead.c

index c05a9126cfe3d9743c114dbe1208db22a95a3626..a58182600daef492df3597d0082699d39e99cca0 100644 (file)
@@ -194,7 +194,7 @@ int ll_update_remote_perm(struct inode *inode, struct mdt_remote_perm *perm)
 
        if (!lli->lli_remote_perms)
                lli->lli_remote_perms = perm_hash;
 
        if (!lli->lli_remote_perms)
                lli->lli_remote_perms = perm_hash;
-       else if (perm_hash)
+       else
                free_rmtperm_hash(perm_hash);
 
        head = lli->lli_remote_perms + remote_perm_hashfunc(perm->rp_uid);
                free_rmtperm_hash(perm_hash);
 
        head = lli->lli_remote_perms + remote_perm_hashfunc(perm->rp_uid);
@@ -209,8 +209,7 @@ again:
                        continue;
                if (tmp->lrp_fsgid != perm->rp_fsgid)
                        continue;
                        continue;
                if (tmp->lrp_fsgid != perm->rp_fsgid)
                        continue;
-               if (lrp)
-                       free_ll_remote_perm(lrp);
+               free_ll_remote_perm(lrp);
                lrp = tmp;
                break;
        }
                lrp = tmp;
                break;
        }
index c4bd09edb0ce617f08d25fe9f018b53b9e9991ce..db2bb44cdce5e151af3155b641a0bda6e90d8831 100644 (file)
@@ -334,8 +334,7 @@ static void ll_sa_entry_put(struct ll_statahead_info *sai,
                LASSERT(ll_sa_entry_unhashed(entry));
 
                ll_sa_entry_cleanup(sai, entry);
                LASSERT(ll_sa_entry_unhashed(entry));
 
                ll_sa_entry_cleanup(sai, entry);
-               if (entry->se_inode)
-                       iput(entry->se_inode);
+               iput(entry->se_inode);
 
                OBD_FREE(entry, entry->se_size);
                atomic_dec(&sai->sai_cache_count);
 
                OBD_FREE(entry, entry->se_size);
                atomic_dec(&sai->sai_cache_count);