ocfs2: delete unnecessary checks before brelse()
authorMarkus Elfring <elfring@users.sourceforge.net>
Mon, 23 Sep 2019 22:33:34 +0000 (15:33 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 24 Sep 2019 22:54:07 +0000 (15:54 -0700)
brelse() tests whether its argument is NULL and then returns immediately.
Thus the tests around the shown calls are not needed.

This issue was detected by using the Coccinelle software.

Link: http://lkml.kernel.org/r/55cde320-394b-f985-56ce-1a2abea782aa@web.de
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Reviewed-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Gang He <ghe@suse.com>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/ocfs2/dlmglue.c
fs/ocfs2/extent_map.c

index ad594fef2ab0f503922c390f1b80227791726d66..6e774c5ea13b37c0210785fd4fcf14aaa00dd0fa 100644 (file)
@@ -2508,9 +2508,7 @@ bail:
                        ocfs2_inode_unlock(inode, ex);
        }
 
-       if (local_bh)
-               brelse(local_bh);
-
+       brelse(local_bh);
        return status;
 }
 
@@ -2593,8 +2591,7 @@ int ocfs2_inode_lock_atime(struct inode *inode,
                *level = 1;
                if (ocfs2_should_update_atime(inode, vfsmnt))
                        ocfs2_update_inode_atime(inode, bh);
-               if (bh)
-                       brelse(bh);
+               brelse(bh);
        } else
                *level = 0;
 
index e66a249fe07c125e5d6c3eab5a8a74a6cc7b85d1..e3e2d1b2af51a267cb056efad36042ee3ee88bf1 100644 (file)
@@ -590,8 +590,7 @@ int ocfs2_xattr_get_clusters(struct inode *inode, u32 v_cluster,
                        *extent_flags = rec->e_flags;
        }
 out:
-       if (eb_bh)
-               brelse(eb_bh);
+       brelse(eb_bh);
        return ret;
 }