summaryrefslogtreecommitdiffstats
path: root/common/console_common.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-12-09 12:40:39 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2015-01-05 11:30:59 +0100
commitab989e458866f0d3efdcdbfd1d8ff8261fcf51a9 (patch)
tree14f5e1027a22fdc1095e88a297208e3fb8f503a5 /common/console_common.c
parent663b895e493c99854e5857f85ecd261149373b87 (diff)
downloadbarebox-ab989e458866f0d3efdcdbfd1d8ff8261fcf51a9.tar.gz
barebox-ab989e458866f0d3efdcdbfd1d8ff8261fcf51a9.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>
Diffstat (limited to 'common/console_common.c')
-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);