OMAP: DSS2: OMAPFB: make DBG() more resistant in if-else constructions
authorNiels de Vos <ndevos@redhat.com>
Tue, 10 May 2011 11:07:33 +0000 (12:07 +0100)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Wed, 11 May 2011 11:20:54 +0000 (14:20 +0300)
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>
drivers/video/omap2/omapfb/omapfb.h

index 4d1cff97be1b3f72a0f0600f01eccc9a2fe3913a..aa1b1d9742760e86507102da28635a2f84a65ca7 100644 (file)
 #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
This page took 0.025078 seconds and 5 git commands to generate.