Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* [PATCH] btrfs: Fix a C compliance issue
@ 2018-06-15 22:36 Bart Van Assche
  2018-06-16 10:28 ` Nikolay Borisov
  0 siblings, 1 reply; 8+ messages in thread
From: Bart Van Assche @ 2018-06-15 22:36 UTC (permalink / raw)
  To: Chris Mason
  Cc: Josef Bacik, David Sterba, linux-btrfs, Bart Van Assche,
	Jeff Mahoney

The C programming language does not allow to use preprocessor statements
inside macro arguments (pr_info() is defined as a macro). Hence rework
the pr_info() statement in btrfs_print_mod_info() such that it becomes
compliant. This patch allows tools like sparse to analyze the BTRFS
source code.

Fixes: 62e855771dac ("btrfs: convert printk(KERN_* to use pr_* calls")
Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Jeff Mahoney <jeffm@suse.com>
Cc: David Sterba <dsterba@suse.com>
---
 fs/btrfs/super.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 81107ad49f3a..dd4980df5b8e 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -2369,7 +2369,7 @@ static __cold void btrfs_interface_exit(void)
 
 static void __init btrfs_print_mod_info(void)
 {
-	pr_info("Btrfs loaded, crc32c=%s"
+	static const char fmt[] = KERN_INFO "Btrfs loaded, crc32c=%s"
 #ifdef CONFIG_BTRFS_DEBUG
 			", debug=on"
 #endif
@@ -2382,8 +2382,8 @@ static void __init btrfs_print_mod_info(void)
 #ifdef CONFIG_BTRFS_FS_REF_VERIFY
 			", ref-verify=on"
 #endif
-			"\n",
-			crc32c_impl());
+			"\n";
+	printk(fmt, crc32c_impl());
 }
 
 static int __init init_btrfs_fs(void)
-- 
2.17.0


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

end of thread, other threads:[~2018-06-20 17:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-15 22:36 [PATCH] btrfs: Fix a C compliance issue Bart Van Assche
2018-06-16 10:28 ` Nikolay Borisov
2018-06-18  9:26   ` David Sterba
2018-06-18  9:31     ` Nikolay Borisov
2018-06-20 16:44       ` Bart Van Assche
2018-06-20 16:55         ` David Sterba
2018-06-20 17:19           ` Jeff Mahoney
2018-06-20 17:58             ` Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox