Skip to content

Commit 856dd6c

Browse files
nathanchancetytso
authored andcommitted
ext4: fix unused iterator variable warnings
When CONFIG_QUOTA is disabled, there are warnings around unused iterator variables: fs/ext4/super.c: In function 'ext4_put_super': fs/ext4/super.c:1262:13: error: unused variable 'i' [-Werror=unused-variable] 1262 | int i, err; | ^ fs/ext4/super.c: In function '__ext4_fill_super': fs/ext4/super.c:5200:22: error: unused variable 'i' [-Werror=unused-variable] 5200 | unsigned int i; | ^ cc1: all warnings being treated as errors The kernel has updated to GNU11, allowing the variables to be declared within the for loop. Do so to clear up the warnings. Fixes: dcbf875 ("ext4: factor out ext4_flex_groups_free()") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Jan Kara <jack@suse.cz> Reviewed-by: Jason Yan <yanaijie@huawei.com> Link: https://lore.kernel.org/r/20230420-ext4-unused-variables-super-c-v1-1-138b6db6c21c@kernel.org Signed-off-by: Theodore Ts'o <tytso@mit.edu>
1 parent 8356595 commit 856dd6c

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

fs/ext4/super.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,7 +1259,7 @@ static void ext4_put_super(struct super_block *sb)
12591259
struct ext4_sb_info *sbi = EXT4_SB(sb);
12601260
struct ext4_super_block *es = sbi->s_es;
12611261
int aborted = 0;
1262-
int i, err;
1262+
int err;
12631263

12641264
/*
12651265
* Unregister sysfs before destroying jbd2 journal.
@@ -1311,7 +1311,7 @@ static void ext4_put_super(struct super_block *sb)
13111311
ext4_flex_groups_free(sbi);
13121312
ext4_percpu_param_destroy(sbi);
13131313
#ifdef CONFIG_QUOTA
1314-
for (i = 0; i < EXT4_MAXQUOTAS; i++)
1314+
for (int i = 0; i < EXT4_MAXQUOTAS; i++)
13151315
kfree(get_qf_name(sb, sbi, i));
13161316
#endif
13171317

@@ -5197,7 +5197,6 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
51975197
ext4_fsblk_t logical_sb_block;
51985198
struct inode *root;
51995199
int ret = -ENOMEM;
5200-
unsigned int i;
52015200
int needs_recovery;
52025201
int err = 0;
52035202
ext4_group_t first_not_zeroed;
@@ -5628,7 +5627,7 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
56285627
#endif
56295628

56305629
#ifdef CONFIG_QUOTA
5631-
for (i = 0; i < EXT4_MAXQUOTAS; i++)
5630+
for (unsigned int i = 0; i < EXT4_MAXQUOTAS; i++)
56325631
kfree(get_qf_name(sb, sbi, i));
56335632
#endif
56345633
fscrypt_free_dummy_policy(&sbi->s_dummy_enc_policy);

0 commit comments

Comments
 (0)