linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8723bs: fix empty-body warning
@ 2017-04-19 17:16 Arnd Bergmann
  0 siblings, 0 replies; only message in thread
From: Arnd Bergmann @ 2017-04-19 17:16 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Hans de Goede; +Cc: Arnd Bergmann, devel, linux-kernel

The newly added driver causes lots of warnings like

drivers/staging/rtl8723bs/core/rtw_recv.c: In function 'validate_recv_frame':
drivers/staging/rtl8723bs/core/rtw_recv.c:1602:4: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
    DBG_COUNTER(adapter->rx_logs.core_rx_pre_data_handled);
drivers/staging/rtl8723bs/core/rtw_xmit.c: In function 'update_attrib':
drivers/staging/rtl8723bs/core/rtw_xmit.c:726:3: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
   DBG_COUNTER(padapter->tx_logs.core_tx_upd_attrib_unknown);
drivers/staging/rtl8723bs/hal/HalPhyRf.c: In function 'ODM_TXPowerTrackingCallback_ThermalMeter':
drivers/staging/rtl8723bs/hal/HalPhyRf.c:146:4: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
drivers/staging/rtl8723bs/hal/HalPhyRf.c:529:6: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
drivers/staging/rtl8723bs/hal/HalPhyRf.c:559:6: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]

When DBG_COUNTER() etc is defined as a non-empty macro, we get the intended
behavior and no warning. Using no_printk() for printing helper functions
as the added advantage of compile-time checking format strings

Fixes: 554c0a3abf21 ("staging: Add rtl8723bs sdio wifi driver")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h  |  9 +++++----
 drivers/staging/rtl8723bs/hal/odm_debug.h     | 15 ++++++++-------
 drivers/staging/rtl8723bs/include/rtw_debug.h |  2 +-
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h
index e3696cf230f6..38414dd8adbd 100644
--- a/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h
+++ b/drivers/staging/rtl8723bs/hal/HalBtcOutSrc.h
@@ -165,10 +165,11 @@ extern u32 		GLBtcDbgType[];
 }
 
 #else
-#define BTC_PRINT(dbgtype, dbgflag, printstr)
-#define BTC_PRINT_F(dbgtype, dbgflag, printstr)
-#define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr)
-#define BTC_PRINT_DATA(dbgtype, dbgflag, _TitleString, _HexData, _HexDataLen)
+#define BTC_PRINT(dbgtype, dbgflag, printstr)		 no_printk printstr
+#define BTC_PRINT_F(dbgtype, dbgflag, printstr)		 no_printk printstr
+#define BTC_PRINT_ADDR(dbgtype, dbgflag, printstr, _Ptr) no_printk printstr
+#define BTC_PRINT_DATA(dbgtype, dbgflag, _TitleString, _HexData, _HexDataLen) \
+			no_printk("%s %p %zu", _TitleString, _HexData, _HexDataLen)
 #endif
 
 typedef struct _BTC_BOARD_INFO {
diff --git a/drivers/staging/rtl8723bs/hal/odm_debug.h b/drivers/staging/rtl8723bs/hal/odm_debug.h
index a89690ea6ba9..2ec4baf57464 100644
--- a/drivers/staging/rtl8723bs/hal/odm_debug.h
+++ b/drivers/staging/rtl8723bs/hal/odm_debug.h
@@ -151,13 +151,14 @@
 		DbgPrint("\n");\
 	}
 #else
-#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)
-#define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)
-#define ODM_RT_ASSERT(pDM_Odm, expr, fmt)
-#define ODM_dbg_enter()
-#define ODM_dbg_exit()
-#define ODM_dbg_trace(str)
-#define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr)
+#define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)		no_printk fmt
+#define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)	no_printk fmt
+#define ODM_RT_ASSERT(pDM_Odm, expr, fmt)		no_printk fmt
+#define ODM_dbg_enter()					do {} while (0)
+#define ODM_dbg_exit()					do {} while (0)
+#define ODM_dbg_trace(str)				no_printk("%s", str)
+#define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr) \
+	no_printk("%s %p", title_str, ptr)
 #endif
 
 void ODM_InitDebugSetting(PDM_ODM_T pDM_Odm);
diff --git a/drivers/staging/rtl8723bs/include/rtw_debug.h b/drivers/staging/rtl8723bs/include/rtw_debug.h
index a1652f158e38..7c951df4c979 100644
--- a/drivers/staging/rtl8723bs/include/rtw_debug.h
+++ b/drivers/staging/rtl8723bs/include/rtw_debug.h
@@ -263,7 +263,7 @@
 #ifdef CONFIG_DBG_COUNTER
 #define DBG_COUNTER(counter) counter++
 #else
-#define DBG_COUNTER(counter)
+#define DBG_COUNTER(counter) do {} while (0)
 #endif
 
 void dump_drv_version(void *sel);
-- 
2.9.0

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-19 17:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-19 17:16 [PATCH] staging: rtl8723bs: fix empty-body warning Arnd Bergmann

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