From 1216f19a899ee5b69f78d3a27f7a9c4d91d973fb Mon Sep 17 00:00:00 2001 From: Ryan McClelland Date: Fri, 15 Apr 2022 14:08:03 -0700 Subject: [PATCH] logging: fix LOG_TAG_MAX_LEN min warning if CONFIG_LOG_TAG_MAX_LEN is 0, then a warning would be generated on the MIN macro always being false, but as CONFIG_LOG_TAG_MAX_LEN is a constant, then it is better to just compile out the function if it's 0. Signed-off-by: Ryan McClelland --- subsys/logging/log_core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/subsys/logging/log_core.c b/subsys/logging/log_core.c index 8090ec0bf0d..a82d0810753 100644 --- a/subsys/logging/log_core.c +++ b/subsys/logging/log_core.c @@ -1271,10 +1271,7 @@ const char *z_log_get_tag(void) int log_set_tag(const char *str) { - if (CONFIG_LOG_TAG_MAX_LEN == 0) { - return -ENOTSUP; - } - +#if CONFIG_LOG_TAG_MAX_LEN > 0 if (str == NULL) { return -EINVAL; } @@ -1291,6 +1288,9 @@ int log_set_tag(const char *str) } return 0; +#else + return -ENOTSUP; +#endif } int log_mem_get_usage(uint32_t *buf_size, uint32_t *usage)