summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-12-09 12:40:39 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-12-09 12:59:20 +0100
commit61d2f7e4b60fc7d34c2b99559e8fcba5e85b4e16 (patch)
tree66f037d42914ecdfdf5c31004f6c14f5888e5ba6
parente847cc2f0b7025e5fb269d0bb336b811f394d46d (diff)
downloadbarebox-61d2f7e4b60fc7d34c2b99559e8fcba5e85b4e16.tar.gz
barebox-61d2f7e4b60fc7d34c2b99559e8fcba5e85b4e16.tar.xz
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 <s.hauer@pengutronix.de>
-rw-r--r--common/console_common.c2
1 files changed, 1 insertions, 1 deletions
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);