Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging: rtl8723bs: Wrap multi-line macros in do-while loop

Wrapping in do-while ensures macros are executed as expected.

Signed-off-by: Justin Vreeland <justin@jvreeland.com>
Reviewed-by: Bastien Nocera <hadess@hadess.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Justin Vreeland and committed by
Greg Kroah-Hartman
e803a374 318dda31

+45 -36
+45 -36
drivers/staging/rtl8723bs/hal/odm_debug.h
··· 105 105 106 106 #if DBG 107 107 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)\ 108 - if (\ 109 - (comp & pDM_Odm->DebugComponents) &&\ 110 - (level <= pDM_Odm->DebugLevel || level == ODM_DBG_SERIOUS)\ 111 - ) {\ 112 - RT_PRINTK fmt;\ 113 - } 108 + do {\ 109 + if (\ 110 + (comp & pDM_Odm->DebugComponents) &&\ 111 + (level <= pDM_Odm->DebugLevel ||\ 112 + level == ODM_DBG_SERIOUS)\ 113 + ) {\ 114 + RT_PRINTK fmt;\ 115 + } \ 116 + } while (0) 114 117 115 118 #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt)\ 116 - if (\ 117 - (comp & pDM_Odm->DebugComponents) &&\ 118 - (level <= pDM_Odm->DebugLevel)\ 119 - ) {\ 120 - RT_PRINTK fmt;\ 121 - } 119 + do {\ 120 + if (\ 121 + (comp & pDM_Odm->DebugComponents) &&\ 122 + (level <= pDM_Odm->DebugLevel)\ 123 + ) {\ 124 + RT_PRINTK fmt;\ 125 + } \ 126 + } while (0) 122 127 123 128 #define ODM_RT_ASSERT(pDM_Odm, expr, fmt)\ 124 - if (!expr) {\ 125 - DbgPrint("Assertion failed! %s at ......\n", #expr);\ 126 - DbgPrint(\ 127 - " ......%s,%s, line =%d\n",\ 128 - __FILE__,\ 129 - __func__,\ 130 - __LINE__\ 131 - );\ 132 - RT_PRINTK fmt;\ 133 - ASSERT(false);\ 134 - } 129 + do {\ 130 + if (!expr) {\ 131 + DbgPrint("Assertion failed! %s at ......\n", #expr);\ 132 + DbgPrint(\ 133 + " ......%s,%s, line =%d\n",\ 134 + __FILE__,\ 135 + __func__,\ 136 + __LINE__\ 137 + );\ 138 + RT_PRINTK fmt;\ 139 + ASSERT(false);\ 140 + } \ 141 + } while (0) 135 142 #define ODM_dbg_enter() { DbgPrint("==> %s\n", __func__); } 136 143 #define ODM_dbg_exit() { DbgPrint("<== %s\n", __func__); } 137 144 #define ODM_dbg_trace(str) { DbgPrint("%s:%s\n", __func__, str); } 138 145 139 146 #define ODM_PRINT_ADDR(pDM_Odm, comp, level, title_str, ptr)\ 140 - if (\ 141 - (comp & pDM_Odm->DebugComponents) &&\ 142 - (level <= pDM_Odm->DebugLevel)\ 143 - ) {\ 144 - int __i;\ 145 - u8 *__ptr = (u8 *)ptr;\ 146 - DbgPrint("[ODM] ");\ 147 - DbgPrint(title_str);\ 148 - DbgPrint(" ");\ 149 - for (__i = 0; __i < 6; __i++)\ 150 - DbgPrint("%02X%s", __ptr[__i], (__i == 5) ? "" : "-");\ 151 - DbgPrint("\n");\ 152 - } 147 + do {\ 148 + if (\ 149 + (comp & pDM_Odm->DebugComponents) &&\ 150 + (level <= pDM_Odm->DebugLevel)\ 151 + ) {\ 152 + int __i;\ 153 + u8 *__ptr = (u8 *)ptr;\ 154 + DbgPrint("[ODM] ");\ 155 + DbgPrint(title_str);\ 156 + DbgPrint(" ");\ 157 + for (__i = 0; __i < 6; __i++)\ 158 + DbgPrint("%02X%s", __ptr[__i], (__i == 5) ? "" : "-");\ 159 + DbgPrint("\n");\ 160 + } \ 161 + } while (0) 153 162 #else 154 163 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt) no_printk fmt 155 164 #define ODM_RT_TRACE_F(pDM_Odm, comp, level, fmt) no_printk fmt