From d6d3f152b36d772e1b5631a0adae0d9105f6641c Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Sun, 22 Sep 2019 17:02:45 -0700 Subject: [PATCH] logging: remove return value from log_printk() printk() doesn't return a value, this doesn't need to either. Signed-off-by: Andrew Boie --- include/logging/log.h | 4 +--- subsys/logging/log_core.c | 12 ++++-------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/include/logging/log.h b/include/logging/log.h index b5246f6b8d6..6f0705e8936 100644 --- a/include/logging/log.h +++ b/include/logging/log.h @@ -257,10 +257,8 @@ extern "C" { * * @param fmt Formatted string to output. * @param ap Variable parameters. - * - * return Number of bytes written. */ -int log_printk(const char *fmt, va_list ap); +void log_printk(const char *fmt, va_list ap); /** @brief Copy transient string to a buffer from internal, logger pool. * diff --git a/subsys/logging/log_core.c b/subsys/logging/log_core.c index be30905c619..a7d661d7a9c 100644 --- a/subsys/logging/log_core.c +++ b/subsys/logging/log_core.c @@ -320,10 +320,8 @@ void log_hexdump(const char *str, } } -int log_printk(const char *fmt, va_list ap) +void log_printk(const char *fmt, va_list ap) { - int length = 0; - if (IS_ENABLED(CONFIG_LOG_PRINTK)) { union { struct log_msg_ids structure; @@ -337,8 +335,7 @@ int log_printk(const char *fmt, va_list ap) if (_is_user_context()) { u8_t str[CONFIG_LOG_PRINTK_MAX_STRING_LENGTH + 1]; - length = vsnprintk(str, sizeof(str), fmt, ap); - length = MIN(length, sizeof(str)); + vsnprintk(str, sizeof(str), fmt, ap); z_log_string_from_user(src_level_union.value, str); } else if (IS_ENABLED(CONFIG_LOG_IMMEDIATE)) { @@ -346,20 +343,19 @@ int log_printk(const char *fmt, va_list ap) } else { u8_t str[CONFIG_LOG_PRINTK_MAX_STRING_LENGTH + 1]; struct log_msg *msg; + int length; length = vsnprintk(str, sizeof(str), fmt, ap); length = MIN(length, sizeof(str)); msg = log_msg_hexdump_create(NULL, str, length); if (msg == NULL) { - return 0; + return; } msg_finalize(msg, src_level_union.structure); } } - - return length; } /** @brief Count number of arguments in formatted string.