[PATCH] staging: rtl8723bs: fix empty-body warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
---
 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

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux