netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] af_llc: fix if-statement empty body warning
@ 2020-02-26  5:08 Randy Dunlap
  2020-02-27  4:38 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Randy Dunlap @ 2020-02-26  5:08 UTC (permalink / raw)
  To: netdev, David Miller

From: Randy Dunlap <rdunlap@infradead.org>

When debugging via dprintk() is not enabled, make the dprintk()
macro be an empty do-while loop, as is done in
<linux/sunrpc/debug.h>.

This fixes a gcc warning when -Wextra is set:
../net/llc/af_llc.c:974:51: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]

I have verified that there is not object code change (with gcc 7.5.0).

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>
---
 net/llc/af_llc.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-next-20200225.orig/net/llc/af_llc.c
+++ linux-next-20200225/net/llc/af_llc.c
@@ -47,7 +47,7 @@ static int llc_ui_wait_for_busy_core(str
 #if 0
 #define dprintk(args...) printk(KERN_DEBUG args)
 #else
-#define dprintk(args...)
+#define dprintk(args...) do {} while (0)
 #endif
 
 /* Maybe we'll add some more in the future. */


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

* Re: [PATCH net-next] af_llc: fix if-statement empty body warning
  2020-02-26  5:08 [PATCH net-next] af_llc: fix if-statement empty body warning Randy Dunlap
@ 2020-02-27  4:38 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-02-27  4:38 UTC (permalink / raw)
  To: rdunlap; +Cc: netdev

From: Randy Dunlap <rdunlap@infradead.org>
Date: Tue, 25 Feb 2020 21:08:52 -0800

> From: Randy Dunlap <rdunlap@infradead.org>
> 
> When debugging via dprintk() is not enabled, make the dprintk()
> macro be an empty do-while loop, as is done in
> <linux/sunrpc/debug.h>.
> 
> This fixes a gcc warning when -Wextra is set:
> ../net/llc/af_llc.c:974:51: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
> 
> I have verified that there is not object code change (with gcc 7.5.0).
> 
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>

Applied.

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

end of thread, other threads:[~2020-02-27  4:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-26  5:08 [PATCH net-next] af_llc: fix if-statement empty body warning Randy Dunlap
2020-02-27  4:38 ` David Miller

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