ocfs2: Delete unnecessary checks before brelse()
Subsystems (2)
PATCH 1/1 ocfs2: Delete unnecessary checks before brelse()
From: Markus Elfring <[email protected]>
Date: Tue, 3 Sep 2019 16:33:32 +0200
The brelse() function 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.
Signed-off-by Markus Elfring <[email protected]>
--- fs/ocfs2/dlmglue.c | 7 ++----- fs/ocfs2/extent_map.c | 3 +-- 2 files changed, 3 insertions(+), 7 deletions(-)
fs/ocfs2/dlmglue.c +2 -5
@@ -2508,9 +2508,7 @@ int ocfs2_inode_lock_full_nested(struct inode *inode,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 ;
fs/ocfs2/extent_map.c +1 -2
@@ -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; }
--
2.23.0
Quoted 10 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Tue, 3 Sep 2019 16:33:32 +0200The
brelse()function 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.
Signed-off-by Markus Elfring <[email protected]>
Reviewed-by Joseph Qi <[email protected]>
Quoted 47 lines
--- fs/ocfs2/dlmglue.c | 7 ++----- fs/ocfs2/extent_map.c | 3 +-- 2 files changed, 3 insertions(+), 7 deletions(-)fs/ocfs2/dlmglue.c +2
-5@@ -2508,9 +2508,7 @@ int ocfs2_inode_lock_full_nested(struct inode *inode,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 ;fs/ocfs2/extent_map.c +1
-3@@ -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; } --2.23.0