Skip to content

Commit 68d7b2d

Browse files
yeyunfeng-devtytso
authored andcommitted
ext4: fix unused-but-set-variable warning in ext4_add_entry()
Warning is found when compile with "-Wunused-but-set-variable": fs/ext4/namei.c: In function ‘ext4_add_entry’: fs/ext4/namei.c:2167:23: warning: variable ‘sbi’ set but not used [-Wunused-but-set-variable] struct ext4_sb_info *sbi; ^~~ Fix this by moving the variable @sbi under CONFIG_UNICODE. Signed-off-by: Yunfeng Ye <[email protected]> Reviewed-by: Ritesh Harjani <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Theodore Ts'o <[email protected]>
1 parent d82d47d commit 68d7b2d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/ext4/namei.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2164,7 +2164,9 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
21642164
struct buffer_head *bh = NULL;
21652165
struct ext4_dir_entry_2 *de;
21662166
struct super_block *sb;
2167+
#ifdef CONFIG_UNICODE
21672168
struct ext4_sb_info *sbi;
2169+
#endif
21682170
struct ext4_filename fname;
21692171
int retval;
21702172
int dx_fallback=0;
@@ -2176,12 +2178,12 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
21762178
csum_size = sizeof(struct ext4_dir_entry_tail);
21772179

21782180
sb = dir->i_sb;
2179-
sbi = EXT4_SB(sb);
21802181
blocksize = sb->s_blocksize;
21812182
if (!dentry->d_name.len)
21822183
return -EINVAL;
21832184

21842185
#ifdef CONFIG_UNICODE
2186+
sbi = EXT4_SB(sb);
21852187
if (ext4_has_strict_mode(sbi) && IS_CASEFOLDED(dir) &&
21862188
sbi->s_encoding && utf8_validate(sbi->s_encoding, &dentry->d_name))
21872189
return -EINVAL;

0 commit comments

Comments
 (0)