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

From: Qian Cai
Date: Fri Jul 12 2019 - 11:30:31 EST


Ping.

On Fri, 2019-06-28 at 10:03 -0400, Qian Cai wrote:
> 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;