Skip to contentSkip to conversation

nilfs: avoid warning about unused variables

PATCH In review Arnd Bergmann 2 participants 2 messages Jun 15, 2016 NILFS2 filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nilfs: avoid warning about unused variables

The newly added nilfs_msg() infrastructure caused a warning in nilfs_clear_dirty_page() when it is disabled:

fs/nilfs2/page.c: In function 'nilfs_clear_dirty_page':
fs/nilfs2/page.c:402:22: error: unused variable 'sb' [-Werror=unused-variable]
struct super_block *sb = inode->i_sb;

We can avoid the warning by adding a cast to void for the first argument of the macro.

Fixes aede53d223f0 ("nilfs2: replace nilfs_warning() with nilfs_msg()")
---
 fs/nilfs2/nilfs.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/nilfs2/nilfs.h +4 -1
index b7064faef217..46fbd4e00315 100644
@@ -317,7 +317,10 @@ void __nilfs_error(struct super_block *sb, const char *function,
 #else
 
 #define nilfs_msg(sb, level, fmt, ...)					\
-	no_printk(fmt, ##__VA_ARGS__)
+	do {								\
+		no_printk(fmt, ##__VA_ARGS__);				\
+		(void)(sb);						\
+	} while (0)
 #define nilfs_error(sb, fmt, ...)					\
 	do {								\
 		no_printk(fmt, ##__VA_ARGS__);				\
Signature · 1 line
2.9.0
#1 lore raw
Quoted 7 lines · Arnd Bergmann

The newly added nilfs_msg() infrastructure caused a warning in nilfs_clear_dirty_page() when it is disabled:

fs/nilfs2/page.c: In function 'nilfs_clear_dirty_page':
fs/nilfs2/page.c:402:22: error: unused variable 'sb' [-Werror=unused-variable]
struct super_block *sb = inode->i_sb;

Quoted 5 lines

We can avoid the warning by adding a cast to void for the first argument of the macro.

Fixes aede53d223f0 ("nilfs2: replace nilfs_warning() with nilfs_msg()")

Thanks for the catch!

Regards,
Ryusuke Konishi

Quoted 27 lines
---
 fs/nilfs2/nilfs.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
fs/nilfs2/nilfs.h +4 -1
index b7064faef217..46fbd4e00315 100644
@@ -317,7 +317,10 @@ void __nilfs_error(struct super_block *sb, const char *function,
 #else
 
 #define nilfs_msg(sb, level, fmt, ...)					\
-	no_printk(fmt, ##__VA_ARGS__)
+	do {								\
+		no_printk(fmt, ##__VA_ARGS__);				\
+		(void)(sb);						\
+	} while (0)
 #define nilfs_error(sb, fmt, ...)					\
 	do {								\
 		no_printk(fmt, ##__VA_ARGS__);				\
Signature · 6 lines
2.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html