* [PATCH v2] ext4: fix Wunused-but-set-variable warning in ext4_add_entry()
@ 2019-12-17 14:46 Yunfeng Ye
2019-12-22 2:01 ` Theodore Y. Ts'o
0 siblings, 1 reply; 2+ messages in thread
From: Yunfeng Ye @ 2019-12-17 14:46 UTC (permalink / raw)
To: tytso, adilger.kernel, linux-ext4, linux-kernel, Ritesh Harjani
Cc: hushiyuan@huawei.com, linfeilong@huawei.com
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 <yeyunfeng@huawei.com>
Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>
---
v1 -> v2:
- add "Reviewed-by"
fs/ext4/namei.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index a856997d87b5..617349be460f 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2164,7 +2164,9 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
struct buffer_head *bh = NULL;
struct ext4_dir_entry_2 *de;
struct super_block *sb;
+#ifdef CONFIG_UNICODE
struct ext4_sb_info *sbi;
+#endif
struct ext4_filename fname;
int retval;
int dx_fallback=0;
@@ -2176,12 +2178,12 @@ static int ext4_add_entry(handle_t *handle, struct dentry *dentry,
csum_size = sizeof(struct ext4_dir_entry_tail);
sb = dir->i_sb;
- sbi = EXT4_SB(sb);
blocksize = sb->s_blocksize;
if (!dentry->d_name.len)
return -EINVAL;
#ifdef CONFIG_UNICODE
+ sbi = EXT4_SB(sb);
if (ext4_has_strict_mode(sbi) && IS_CASEFOLDED(dir) &&
sbi->s_encoding && utf8_validate(sbi->s_encoding, &dentry->d_name))
return -EINVAL;
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] ext4: fix Wunused-but-set-variable warning in ext4_add_entry()
2019-12-17 14:46 [PATCH v2] ext4: fix Wunused-but-set-variable warning in ext4_add_entry() Yunfeng Ye
@ 2019-12-22 2:01 ` Theodore Y. Ts'o
0 siblings, 0 replies; 2+ messages in thread
From: Theodore Y. Ts'o @ 2019-12-22 2:01 UTC (permalink / raw)
To: Yunfeng Ye
Cc: adilger.kernel, linux-ext4, linux-kernel, Ritesh Harjani,
hushiyuan@huawei.com, linfeilong@huawei.com
On Tue, Dec 17, 2019 at 10:46:49PM +0800, Yunfeng Ye wrote:
> 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 <yeyunfeng@huawei.com>
> Reviewed-by: Ritesh Harjani <riteshh@linux.ibm.com>
Thanks, applied.
- Ted
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-12-22 2:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-12-17 14:46 [PATCH v2] ext4: fix Wunused-but-set-variable warning in ext4_add_entry() Yunfeng Ye
2019-12-22 2:01 ` Theodore Y. Ts'o
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).