Skip to contentSkip to conversation

ext2: remove redundant assignment to variable desc and variable best_desc

PATCH In review Colin Ian King 2 participants 2 messages Jun 30, 2023 – Jul 3, 2023

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

PATCH v2 1/1 ext2: remove redundant assignment to variable desc and variable best_desc

Variable desc is being assigned a value that is never read, the exit via label found immeditely returns with no access to desc. The assignment is redundant and can be removed. Also remove variable best_desc since this is not used. Cleans up clang scan muild warning:

fs/ext2/ialloc.c:297:4: warning: Value stored to 'desc' is never read [deadcode.DeadStores]

---

V2: Also remove best_desc. Kudos to Dan Carpenter for spottin this extra
janitorial cleanup.

---
 fs/ext2/ialloc.c | 3 ---
 1 file changed, 3 deletions(-)
fs/ext2/ialloc.c +0 -3
index a4e1d7a9c544..34cd5dc1da23 100644
@@ -273,7 +273,6 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
 
 	if ((parent == d_inode(sb->s_root)) ||
 	    (EXT2_I(parent)->i_flags & EXT2_TOPDIR_FL)) {
-		struct ext2_group_desc *best_desc = NULL;
 		int best_ndir = inodes_per_group;
 		int best_group = -1;
 
@@ -291,10 +290,8 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
 				continue;
 			best_group = group;
 			best_ndir = le16_to_cpu(desc->bg_used_dirs_count);
-			best_desc = desc;
 		}
 		if (best_group >= 0) {
-			desc = best_desc;
 			group = best_group;
 			goto found;
 		}
Signature · 1 line
2.39.2
#1 lore raw
Quoted 9 lines · Colin Ian King

Variable desc is being assigned a value that is never read, the exit via label found immeditely returns with no access to desc. The assignment is redundant and can be removed. Also remove variable best_desc since this is not used. Cleans up clang scan muild warning:

fs/ext2/ialloc.c:297:4: warning: Value stored to 'desc' is never read [deadcode.DeadStores]

Thanks, I've added the patch to my tree.

Honza

Quoted 35 lines

---

V2: Also remove best_desc. Kudos to Dan Carpenter for spottin this extra
janitorial cleanup.

---
 fs/ext2/ialloc.c | 3 ---
 1 file changed, 3 deletions(-)
fs/ext2/ialloc.c +0 -3
index a4e1d7a9c544..34cd5dc1da23 100644
@@ -273,7 +273,6 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
 
 	if ((parent == d_inode(sb->s_root)) ||
 	    (EXT2_I(parent)->i_flags & EXT2_TOPDIR_FL)) {
-		struct ext2_group_desc *best_desc = NULL;
 		int best_ndir = inodes_per_group;
 		int best_group = -1;
 
@@ -291,10 +290,8 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent)
 				continue;
 			best_group = group;
 			best_ndir = le16_to_cpu(desc->bg_used_dirs_count);
-			best_desc = desc;
 		}
 		if (best_group >= 0) {
-			desc = best_desc;
 			group = best_group;
 			goto found;
 		}
Signature · 1 line
2.39.2
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR