linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nilfs: avoid warning about unused variables
@ 2016-06-15 20:19 Arnd Bergmann
  2016-06-15 22:05 ` Ryusuke Konishi
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2016-06-15 20:19 UTC (permalink / raw)
  To: Ryusuke Konishi; +Cc: Arnd Bergmann, Andrew Morton, linux-nilfs, linux-kernel

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: aede53d223f0 ("nilfs2: replace nilfs_warning() with nilfs_msg()")
---
 fs/nilfs2/nilfs.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h
index b7064faef217..46fbd4e00315 100644
--- a/fs/nilfs2/nilfs.h
+++ b/fs/nilfs2/nilfs.h
@@ -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__);				\
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nilfs: avoid warning about unused variables
  2016-06-15 20:19 [PATCH] nilfs: avoid warning about unused variables Arnd Bergmann
@ 2016-06-15 22:05 ` Ryusuke Konishi
  0 siblings, 0 replies; 2+ messages in thread
From: Ryusuke Konishi @ 2016-06-15 22:05 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Andrew Morton, linux-nilfs, linux-kernel

On Wed, 15 Jun 2016 22:19:41 +0200, Arnd Bergmann <arnd@arndb.de> wrote:
> 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.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: aede53d223f0 ("nilfs2: replace nilfs_warning() with nilfs_msg()")

Thanks for the catch!

Regards,
Ryusuke Konishi


> ---
>  fs/nilfs2/nilfs.h | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/nilfs2/nilfs.h b/fs/nilfs2/nilfs.h
> index b7064faef217..46fbd4e00315 100644
> --- a/fs/nilfs2/nilfs.h
> +++ b/fs/nilfs2/nilfs.h
> @@ -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__);				\
> -- 
> 2.9.0
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nilfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-15 22:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-15 20:19 [PATCH] nilfs: avoid warning about unused variables Arnd Bergmann
2016-06-15 22:05 ` Ryusuke Konishi

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).