Skip to contentSkip to conversation

fs/ntfs3: remove redundant assignment to variable vcn

PATCH In review Colin Ian King 3 participants 3 messages Apr 18, 2022 – Jun 8, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/ntfs3: remove redundant assignment to variable vcn

Variable vcn is being assigned a value that is never read, it is being re-assigned again in the initialization of a for-loop. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
fs/ntfs3/attrib.c:1176:7: warning: Value stored to 'vcn' during its initialization is never read [deadcode.DeadStores]

---
 fs/ntfs3/attrib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/attrib.c +1 -1
index e8c00dda42ad..fc0623b029e6 100644
@@ -1173,7 +1173,7 @@ int attr_load_runs_range(struct ntfs_inode *ni, enum ATTR_TYPE type,
 {
 	struct ntfs_sb_info *sbi = ni->mi.sbi;
 	u8 cluster_bits = sbi->cluster_bits;
-	CLST vcn = from >> cluster_bits;
+	CLST vcn;
 	CLST vcn_last = (to - 1) >> cluster_bits;
 	CLST lcn, clen;
 	int err;
Signature · 1 line
2.35.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Colin Ian King

Variable vcn is being assigned a value that is never read, it is being re-assigned again in the initialization of a for-loop. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
fs/ntfs3/attrib.c:1176:7: warning: Value stored to 'vcn' during its initialization is never read [deadcode.DeadStores]

Quoted 17 lines
---
  fs/ntfs3/attrib.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/attrib.c +1 -1
index e8c00dda42ad..fc0623b029e6 100644
@@ -1173,7 +1173,7 @@ int attr_load_runs_range(struct ntfs_inode *ni, enum ATTR_TYPE type,
  {
  	struct ntfs_sb_info *sbi = ni->mi.sbi;
  	u8 cluster_bits = sbi->cluster_bits;
-	CLST vcn = from >> cluster_bits;
+	CLST vcn;
  	CLST vcn_last = (to - 1) >> cluster_bits;
  	CLST lcn, clen;
  	int err;
#2 lore raw
In reply to Colin Ian King
Quoted 18 lines · Colin Ian King

Variable vcn is being assigned a value that is never read, it is being re-assigned again in the initialization of a for-loop. The assignment is redundant and can be removed.

Cleans up clang scan build warning:
fs/ntfs3/attrib.c:1176:7: warning: Value stored to 'vcn' during its initialization is never read [deadcode.DeadStores]

---
  fs/ntfs3/attrib.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
fs/ntfs3/attrib.c +0 -0
index e8c00dda42ad..fc0623b029e6 100644

fs/ntfs3/attrib.c int attr_load_runs_range(struct ntfs_inode *ni, enum ATTR_TYPE type, · line 1179

Quoted 8 lines
fs/ntfs3/attrib.c +1 -1
@@ -1173,7 +1173,7 @@ int attr_load_runs_range(struct ntfs_inode *ni, enum ATTR_TYPE type,
  {
  	struct ntfs_sb_info *sbi = ni->mi.sbi;
  	u8 cluster_bits = sbi->cluster_bits;
-	CLST vcn = from >> cluster_bits;
+	CLST vcn;
  	CLST vcn_last = (to - 1) >> cluster_bits;
  	CLST lcn, clen;
  	int err;

Thanks for patch, applied!