diff --git a/lib/console.c b/lib/console.c index beb755f835..29b2524959 100644 --- a/lib/console.c +++ b/lib/console.c @@ -132,6 +132,10 @@ int printk(int msg_level, const char *fmt, ...) va_list args; int i; + if (msg_level > console_loglevel()) { + return 0; + } + #ifdef CONFIG_CONSOLE_PREPEND_LOG_LEVEL console_tx_byte('<', (void *)0); console_tx_byte(msg_level + '0', (void *)0); @@ -142,10 +146,6 @@ int printk(int msg_level, const char *fmt, ...) i = 0; #endif - if (msg_level > console_loglevel()) { - return 0; - } - va_start(args, fmt); i += vtxprintf(console_tx_byte, (void *)0, fmt, args); va_end(args);