From ab989e458866f0d3efdcdbfd1d8ff8261fcf51a9 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Tue, 9 Dec 2014 12:40:39 +0100 Subject: console: Make sure xzalloc is only used when it's available 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 --- common/console_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'common/console_common.c') diff --git a/common/console_common.c b/common/console_common.c index cc25f97d9d..df1b085982 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); -- cgit v1.2.3