mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] fix another brown paper bag bug introduced with compile time loglevel
@ 2013-03-07  7:21 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2013-03-07  7:21 UTC (permalink / raw)
  To: barebox

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

Fix this by writing this without a local variable.

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

diff --git a/include/printk.h b/include/printk.h
index 3de8905..3cd7335 100644
--- a/include/printk.h
+++ b/include/printk.h
@@ -46,10 +46,7 @@ int dev_printf(const struct device_d *dev, const char *format, ...)
 
 #define __pr_printk(level, format, args...) \
 	({	\
-		int ret = 0;	\
-		if (level <= LOGLEVEL) \
-			ret = printk(format, ##args);	\
-		ret;					\
+		(level) <= LOGLEVEL ? printk((format), ##args) : 0; \
 	 })
 
 #ifndef pr_fmt
-- 
1.8.2.rc2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-03-07  7:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-07  7:21 [PATCH] fix another brown paper bag bug introduced with compile time loglevel Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox