[PATCH v2] fix brown paper bag bug introduced with compile time loglevel

Sascha Hauer s.hauer at pengutronix.de
Fri Feb 15 10:39:09 EST 2013


__dev_printf is a define which uses a local variable 'ret'. This
means that whenever someone does a dev_*(dev, "ret: %d\n", ret);
ret will be 0.

Fix this by writing this without a local variable.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 include/printk.h |    5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/include/printk.h b/include/printk.h
index 1d45616..3de8905 100644
--- a/include/printk.h
+++ b/include/printk.h
@@ -23,10 +23,7 @@ int dev_printf(const struct device_d *dev, const char *format, ...)
 
 #define __dev_printf(level, dev, format, args...) \
 	({	\
-		int ret = 0; \
-		if (level <= LOGLEVEL) \
-			ret = dev_printf(dev, format, ##args);	\
-		ret;						\
+		(level) <= LOGLEVEL ? dev_printf((dev), (format), ##args) : 0; \
 	 })
 
 
-- 
1.7.10.4




More information about the barebox mailing list