Skip to contentSkip to conversation

resize2fs: remove unused variable from adjust_superblock()

PATCH In review Eric Biggers 2 participants 2 messages Jan 4, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 resize2fs: remove unused variable from adjust_superblock()

From: Eric Biggers <[email protected]>

In adjust_superblock(), the 'group_block' variable is declared and set, but it is never actually used. Remove it.

This addresses the following compiler warning with clang -Wall:

resize2fs.c:1119:11: warning: variable 'group_block' set but not used [-Wunused-but-set-variable]

        blk64_t         group_block;
                        ^
---
 resize/resize2fs.c | 4 ----
 1 file changed, 4 deletions(-)
resize/resize2fs.c +0 -4
index 243cd777..5eeb7d44 100644
@@ -1116,7 +1116,6 @@ static errcode_t adjust_superblock(ext2_resize_t rfs, blk64_t new_size)
 	ext2_filsys	fs = rfs->new_fs;
 	int		adj = 0;
 	errcode_t	retval;
-	blk64_t		group_block;
 	unsigned long	i;
 	unsigned long	max_group;
 
@@ -1181,8 +1180,6 @@ static errcode_t adjust_superblock(ext2_resize_t rfs, blk64_t new_size)
 		goto errout;
 
 	memset(rfs->itable_buf, 0, fs->blocksize * fs->inode_blocks_per_group);
-	group_block = ext2fs_group_first_block2(fs,
-						rfs->old_fs->group_desc_count);
 	adj = rfs->old_fs->group_desc_count;
 	max_group = fs->group_desc_count - adj;
 	if (rfs->progress) {
@@ -1209,7 +1206,6 @@ static errcode_t adjust_superblock(ext2_resize_t rfs, blk64_t new_size)
 			if (retval)
 				goto errout;
 		}
-		group_block += fs->super->s_blocks_per_group;
 	}
 	io_channel_flush(fs->io);
 	retval = 0;
Signature · 1 line
2.39.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Eric Biggers

From: Eric Biggers <[email protected]>

In adjust_superblock(), the 'group_block' variable is declared and set, but it is never actually used. Remove it.

This addresses the following compiler warning with clang -Wall:

resize2fs.c:1119:11: warning: variable 'group_block' set but not used [-Wunused-but-set-variable]

        blk64_t         group_block;

Looks good thanks.

Quoted 38 lines
                        ^
---
 resize/resize2fs.c | 4 ----
 1 file changed, 4 deletions(-)
resize/resize2fs.c +0 -4
index 243cd777..5eeb7d44 100644
@@ -1116,7 +1116,6 @@ static errcode_t adjust_superblock(ext2_resize_t rfs, blk64_t new_size)
 	ext2_filsys	fs = rfs->new_fs;
 	int		adj = 0;
 	errcode_t	retval;
-	blk64_t		group_block;
 	unsigned long	i;
 	unsigned long	max_group;
 
@@ -1181,8 +1180,6 @@ static errcode_t adjust_superblock(ext2_resize_t rfs, blk64_t new_size)
 		goto errout;
 
 	memset(rfs->itable_buf, 0, fs->blocksize * fs->inode_blocks_per_group);
-	group_block = ext2fs_group_first_block2(fs,
-						rfs->old_fs->group_desc_count);
 	adj = rfs->old_fs->group_desc_count;
 	max_group = fs->group_desc_count - adj;
 	if (rfs->progress) {
@@ -1209,7 +1206,6 @@ static errcode_t adjust_superblock(ext2_resize_t rfs, blk64_t new_size)
 			if (retval)
 				goto errout;
 		}
-		group_block += fs->super->s_blocks_per_group;
 	}
 	io_channel_flush(fs->io);
 	retval = 0;
Signature · 1 line
2.39.0