mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH v2] fix brown paper bag bug introduced with compile time loglevel
Date: Fri, 15 Feb 2013 16:39:09 +0100	[thread overview]
Message-ID: <1360942749-28102-1-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1360942214-8280-1-git-send-email-s.hauer@pengutronix.de>

__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@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


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

      reply	other threads:[~2013-02-15 15:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-15 15:30 [PATCH] " Sascha Hauer
2013-02-15 15:39 ` Sascha Hauer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1360942749-28102-1-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox