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 5/5] startup: Print error message when initcall fails
Date: Sun,  7 Oct 2012 13:39:51 +0200	[thread overview]
Message-ID: <1349609991-26567-6-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1349609991-26567-1-git-send-email-s.hauer@pengutronix.de>

There was a time when we used to panic when initcalls failed. Then
it was changed to totally ignore the return value. Instead, print
an error message now so that the user can get a clue when something
bad happened. So initcalls are now recommended to actually return
negative error codes when something fails.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/startup.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/startup.c b/common/startup.c
index b53bbef..775f97c 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -100,7 +100,9 @@ void start_barebox (void)
 			initcall < __barebox_initcalls_end; initcall++) {
 		debug("initcall-> %pS\n", *initcall);
 		result = (*initcall)();
-		debug("initcall<- %pS (%d)\n", *initcall, result);
+		if (result)
+			pr_err("initcall %pS failed: %s\n", *initcall,
+					strerror(-result));
 	}
 
 	debug("initcalls done\n");
-- 
1.7.10.4


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

      parent reply	other threads:[~2012-10-07 11:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-07 11:39 [PATCH] misc improvements Sascha Hauer
2012-10-07 11:39 ` [PATCH 1/5] driver: print error message when probe fails Sascha Hauer
2012-10-07 11:39 ` [PATCH 2/5] resource: statically initialize iomem resource Sascha Hauer
2012-10-07 11:39 ` [PATCH 3/5] console: Cleanup console activation Sascha Hauer
2012-10-07 11:39 ` [PATCH 4/5] console: cleanup Kconfig Sascha Hauer
2012-10-07 11: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=1349609991-26567-6-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