浏览代码

OMAP: DSS2: OMAPFB: make DBG() more resistant in if-else constructions

When DBG() is used in a simple if-else, the resulting code path
currently depends on the definition of DBG(). Inserting the statement in
a "do { ... } while (0)" prevents this possible misuse.

Signed-off-by: Niels de Vos <ndevos@redhat.com>
[tomi.valkeinen@ti.com: changed the title of the commit msg]
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Niels de Vos 14 年之前
父节点
当前提交
41b21aebe6
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      drivers/video/omap2/omapfb/omapfb.h

+ 4 - 2
drivers/video/omap2/omapfb/omapfb.h

@@ -34,8 +34,10 @@
 #ifdef DEBUG
 extern unsigned int omapfb_debug;
 #define DBG(format, ...) \
-	if (omapfb_debug) \
-		printk(KERN_DEBUG "OMAPFB: " format, ## __VA_ARGS__)
+	do { \
+		if (omapfb_debug) \
+			printk(KERN_DEBUG "OMAPFB: " format, ## __VA_ARGS__); \
+	} while (0)
 #else
 #define DBG(format, ...)
 #endif