xfs
[Top] [All Lists]

[PATCH] XFS: Delete unnecessary checks before the function call "xfs_qm_

To: Dave Chinner <david@xxxxxxxxxxxxx>, xfs@xxxxxxxxxxx
Subject: [PATCH] XFS: Delete unnecessary checks before the function call "xfs_qm_dqrele"
From: SF Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 26 Jun 2015 11:15:31 +0200
Cc: LKML <linux-kernel@xxxxxxxxxxxxxxx>, kernel-janitors@xxxxxxxxxxxxxxx, Julia Lawall <julia.lawall@xxxxxxx>
Delivered-to: xfs@xxxxxxxxxxx
In-reply-to: <20141130230904.GF16151@dastard>
References: <530C5E18.1020800@xxxxxxxxxxxxxxxxxxxxx> <alpine.DEB.2.10.1402251014170.2080@hadrien> <530CD2C4.4050903@xxxxxxxxxxxxxxxxxxxxx> <alpine.DEB.2.10.1402251840450.7035@hadrien> <530CF8FF.8080600@xxxxxxxxxxxxxxxxxxxxx> <alpine.DEB.2.02.1402252117150.2047@xxxxxxxxxxxxxxxxxxxxxxx> <530DD06F.4090703@xxxxxxxxxxxxxxxxxxxxx> <alpine.DEB.2.02.1402262129250.2221@xxxxxxxxxxxxxxxxxxxxxxx> <5317A59D.4@xxxxxxxxxxxxxxxxxxxxx> <5479F823.60900@xxxxxxxxxxxxxxxxxxxxx> <20141130230904.GF16151@dastard>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0
From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 26 Jun 2015 11:05:41 +0200

The xfs_qm_dqrele() 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@xxxxxxxxxxxxxxxxxxxxx>
---
 fs/xfs/xfs_qm_syscalls.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/xfs/xfs_qm_syscalls.c b/fs/xfs/xfs_qm_syscalls.c
index 3640c6e..6deee1e 100644
--- a/fs/xfs/xfs_qm_syscalls.c
+++ b/fs/xfs/xfs_qm_syscalls.c
@@ -735,15 +735,15 @@ xfs_dqrele_inode(
        }
 
        xfs_ilock(ip, XFS_ILOCK_EXCL);
-       if ((flags & XFS_UQUOTA_ACCT) && ip->i_udquot) {
+       if (flags & XFS_UQUOTA_ACCT) {
                xfs_qm_dqrele(ip->i_udquot);
                ip->i_udquot = NULL;
        }
-       if ((flags & XFS_GQUOTA_ACCT) && ip->i_gdquot) {
+       if (flags & XFS_GQUOTA_ACCT) {
                xfs_qm_dqrele(ip->i_gdquot);
                ip->i_gdquot = NULL;
        }
-       if ((flags & XFS_PQUOTA_ACCT) && ip->i_pdquot) {
+       if (flags & XFS_PQUOTA_ACCT) {
                xfs_qm_dqrele(ip->i_pdquot);
                ip->i_pdquot = NULL;
        }
-- 
2.4.4

<Prev in Thread] Current Thread [Next in Thread>