Skip to contentSkip to conversation

ocfs2: remove deadcode on variable tmp_oh check

PATCH Superseded Colin King 2 participants 2 messages Aug 30, 2019 – Sep 2, 2019

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 ocfs2: remove deadcode on variable tmp_oh check

From: Colin Ian King <[email protected]>

At the end of cfs2_inode_lock_tracker tmp_oh is true because an earlier check on tmp_oh being false returns out of the function. Since tmp_oh is true, the function will always return 1 so remove the redundant check and return of 0.

Addresses-Coverity: ("Logically dead code")

---
 fs/ocfs2/dlmglue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/dlmglue.c +1 -1
index ad594fef2ab0..ff0cf851c9e6 100644
@@ -2712,7 +2712,7 @@ int ocfs2_inode_lock_tracker(struct inode *inode,
 			return status;
 		}
 	}
-	return tmp_oh ? 1 : 0;
+	return 1;
 }
 
 void ocfs2_inode_unlock_tracker(struct inode *inode,
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 3 lines · Colin King

From: Colin Ian King <[email protected]>

At the end of cfs2_inode_lock_tracker tmp_oh is true because an

s/cfs2_inode_lock_tracker/ocfs2_inode_lock_tracker/
BTW, could you please correct the following description of this function as well?
"return = -1 if this lock attempt will cause an upgrade which is forbidden." In fact, it returns -EINVAL.

Thanks,
Joseph

Quoted 24 lines

earlier check on tmp_oh being false returns out of the function. Since tmp_oh is true, the function will always return 1 so remove the redundant check and return of 0.

Addresses-Coverity: ("Logically dead code")

---
 fs/ocfs2/dlmglue.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ocfs2/dlmglue.c +1 -1
index ad594fef2ab0..ff0cf851c9e6 100644
@@ -2712,7 +2712,7 @@ int ocfs2_inode_lock_tracker(struct inode *inode,
 			return status;
 		}
 	}
-	return tmp_oh ? 1 : 0;
+	return 1;
 }
 
 void ocfs2_inode_unlock_tracker(struct inode *inode,