All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 3/4] staging: rtl8188eu: include: enclosed macros in do-while loops
@ 2020-07-18  9:17 B K Karthik
  2020-07-18 12:33   ` kernel test robot
  2020-07-18 18:00   ` kernel test robot
  0 siblings, 2 replies; 5+ messages in thread
From: B K Karthik @ 2020-07-18  9:17 UTC (permalink / raw)
  To: Larry Finger, Greg Kroah-Hartman, Michael Straube, devel,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1591 bytes --]

enclosed macros starting with if inside do-while loops to
avoid possible if-else logic defects

Signed-off-by: B K Karthik <karthik.bk2000@live.com>
---
 drivers/staging/rtl8188eu/include/odm_debug.h | 28 +++++++++++--------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/rtl8188eu/include/odm_debug.h b/drivers/staging/rtl8188eu/include/odm_debug.h
index 857c64b8d2f4..c7a928d396b0 100644
--- a/drivers/staging/rtl8188eu/include/odm_debug.h
+++ b/drivers/staging/rtl8188eu/include/odm_debug.h
@@ -76,20 +76,24 @@
 #endif
 
 #define ODM_RT_TRACE(pDM_Odm, comp, level, fmt)				\
-	if (((comp) & pDM_Odm->DebugComponents) &&			\
-	    (level <= pDM_Odm->DebugLevel)) {				\
-		pr_info("[ODM-8188E] ");				\
-		RT_PRINTK fmt;						\
-	}
+	do {
+		if (((comp) & pDM_Odm->DebugComponents) &&			\
+			(level <= pDM_Odm->DebugLevel)) {			\
+			pr_info("[ODM-8188E] ");				\
+			RT_PRINTK fmt;						\
+		}
+	} while (0)
 
 #define ODM_RT_ASSERT(pDM_Odm, expr, fmt)				\
-	if (!(expr)) {							\
-		pr_info("Assertion failed! %s at ......\n", #expr);	\
-		pr_info("      ......%s,%s,line=%d\n", __FILE__,	\
-			__func__, __LINE__);				\
-		RT_PRINTK fmt;						\
-		ASSERT(false);						\
-	}
+	do {
+		if (!(expr)) {							\
+			pr_info("Assertion failed! %s at ......\n", #expr);	\
+			pr_info("      ......%s,%s,line=%d\n", __FILE__,	\
+				__func__, __LINE__);				\
+			RT_PRINTK fmt;						\
+			ASSERT(false);						\
+		}
+	} while (0)
 
 void ODM_InitDebugSetting(struct odm_dm_struct *pDM_Odm);
 
-- 
2.20.1


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

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

end of thread, other threads:[~2020-07-18 18:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-18  9:17 [PATCH 3/4] staging: rtl8188eu: include: enclosed macros in do-while loops B K Karthik
2020-07-18 12:33 ` kernel test robot
2020-07-18 12:33   ` kernel test robot
2020-07-18 18:00 ` kernel test robot
2020-07-18 18:00   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.