xfs: remove unnecessary null checks
authorMarkus Elfring <elfring@users.sourceforge.net>
Sun, 30 Nov 2014 21:24:20 +0000 (08:24 +1100)
committerDave Chinner <david@fromorbit.com>
Sun, 30 Nov 2014 21:24:20 +0000 (08:24 +1100)
The functions xfs_blkdev_put() and xfs_qm_dqrele() test whether
their argument is NULL and then return 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>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
fs/xfs/xfs_qm.c
fs/xfs/xfs_super.c

index d68f23021af3587cbaed9a3ad90d71343bceee7e..9a4b50a411f39594bc1638d480b2b6d361cfb4e2 100644 (file)
@@ -1749,23 +1749,21 @@ xfs_qm_vop_dqalloc(
        xfs_iunlock(ip, lockflags);
        if (O_udqpp)
                *O_udqpp = uq;
-       else if (uq)
+       else
                xfs_qm_dqrele(uq);
        if (O_gdqpp)
                *O_gdqpp = gq;
-       else if (gq)
+       else
                xfs_qm_dqrele(gq);
        if (O_pdqpp)
                *O_pdqpp = pq;
-       else if (pq)
+       else
                xfs_qm_dqrele(pq);
        return 0;
 
 error_rele:
-       if (gq)
-               xfs_qm_dqrele(gq);
-       if (uq)
-               xfs_qm_dqrele(uq);
+       xfs_qm_dqrele(gq);
+       xfs_qm_dqrele(uq);
        return error;
 }
 
index 9f622feda6a43bb32ea1983779a48d20b1446391..95745be3ab473d3a74e64b21a9a5f702e7b19557 100644 (file)
@@ -796,8 +796,7 @@ xfs_open_devices(
  out_free_ddev_targ:
        xfs_free_buftarg(mp, mp->m_ddev_targp);
  out_close_rtdev:
-       if (rtdev)
-               xfs_blkdev_put(rtdev);
+       xfs_blkdev_put(rtdev);
  out_close_logdev:
        if (logdev && logdev != ddev)
                xfs_blkdev_put(logdev);