[PATCH 5/5] startup: Print error message when initcall fails

Sascha Hauer s.hauer at pengutronix.de
Sun Oct 7 07:39:51 EDT 2012


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 at 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




More information about the barebox mailing list