[PATCH v3] powerpc/setup_64: fix -Wempty-body warnings

From: Qian Cai
Date: Fri Jun 28 2019 - 10:04:07 EST


At the beginning of setup_64.c, it has,

#ifdef DEBUG
#define DBG(fmt...) udbg_printf(fmt)
#else
#define DBG(fmt...)
#endif

where DBG() could be compiled away, and generate warnings,

arch/powerpc/kernel/setup_64.c: In function 'initialize_cache_info':
arch/powerpc/kernel/setup_64.c:579:49: warning: suggest braces around
empty body in an 'if' statement [-Wempty-body]
DBG("Argh, can't find dcache properties !\n");
^
arch/powerpc/kernel/setup_64.c:582:49: warning: suggest braces around
empty body in an 'if' statement [-Wempty-body]
DBG("Argh, can't find icache properties !\n");

Fix it by using the no_printk() macro, and make sure that format and
argument are always verified by the compiler.

Suggested-by: Tyrel Datwyler <tyreld@xxxxxxxxxxxxxxxxxx>
Suggested-by: Joe Perches <joe@xxxxxxxxxxx>
Signed-off-by: Qian Cai <cai@xxxxxx>
---

v3: Use no_printk() macro, and make sure that format and argument are always
verified by the compiler using a more generic form ##__VA_ARGS__ per Joe.

v2: Fix it by using a NOP while loop per Tyrel.

arch/powerpc/kernel/setup_64.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index 44b4c432a273..cea933a43f0a 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -69,9 +69,9 @@
#include "setup.h"

#ifdef DEBUG
-#define DBG(fmt...) udbg_printf(fmt)
+#define DBG(fmt, ...) udbg_printf(fmt, ##__VA_ARGS__)
#else
-#define DBG(fmt...)
+#define DBG(fmt, ...) no_printk(fmt, ##__VA_ARGS__)
#endif

int spinning_secondaries;
--
1.8.3.1