[PATCH 7/9] console: Make sure xzalloc is only used when it's available

Sascha Hauer s.hauer at pengutronix.de
Tue Dec 9 10:17:42 PST 2014


To make it possible to call the pr_* functions very early before
malloc is initialized test if malloc is available before using
it.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 common/console_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/console_common.c b/common/console_common.c
index cc25f97..df1b085 100644
--- a/common/console_common.c
+++ b/common/console_common.c
@@ -101,7 +101,7 @@ void pr_puts(int level, const char *str)
 {
 	struct log_entry *log;
 
-	if (IS_ENABLED(CONFIG_LOGBUF)) {
+	if (IS_ENABLED(CONFIG_LOGBUF) && mem_malloc_is_initialized()) {
 		if (barebox_log_max_messages > 0)
 			log_clean(barebox_log_max_messages - 1);
 
-- 
2.1.3




More information about the barebox mailing list