diff options
author | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2018-08-28 11:44:44 +0100 |
---|---|---|
committer | Antonio Nino Diaz <antonio.ninodiaz@arm.com> | 2018-08-30 16:22:52 +0100 |
commit | 5a22e461b5841795c592a08b14c949c46c74e261 (patch) | |
tree | 13d08f9f1a47f8fd736f4780db190bcf3fa00734 /common | |
parent | d5ccb754af8664af33a1f5924ccbd75aa905587a (diff) |
Fix MISRA defects in log helpers
No functional changes.
Change-Id: I850f08718abb69d5d58856b0e3de036266d8c2f4
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Diffstat (limited to 'common')
-rw-r--r-- | common/tf_log.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/common/tf_log.c b/common/tf_log.c index 6da1e85b..422959f6 100644 --- a/common/tf_log.c +++ b/common/tf_log.c @@ -28,19 +28,21 @@ void tf_log(const char *fmt, ...) log_level = fmt[0]; /* Verify that log_level is one of LOG_MARKER_* macro defined in debug.h */ - assert(log_level && log_level <= LOG_LEVEL_VERBOSE); - assert(log_level % 10 == 0); + assert((log_level > 0U) && (log_level <= LOG_LEVEL_VERBOSE)); + assert((log_level % 10U) == 0U); if (log_level > max_log_level) return; prefix_str = plat_log_get_prefix(log_level); - while (*prefix_str) - putchar(*prefix_str++); + while (*prefix_str != '\0') { + (void)putchar(*prefix_str); + prefix_str++; + } va_start(args, fmt); - vprintf(fmt + 1, args); + (void)vprintf(fmt + 1, args); va_end(args); } @@ -52,10 +54,9 @@ void tf_log(const char *fmt, ...) void tf_log_set_max_level(unsigned int log_level) { assert(log_level <= LOG_LEVEL_VERBOSE); - assert((log_level % 10) == 0); + assert((log_level % 10U) == 0U); /* Cap log_level to the compile time maximum. */ - if (log_level < LOG_LEVEL) + if (log_level < (unsigned int)LOG_LEVEL) max_log_level = log_level; - } |