logging: Fix 10.4 violations

Both operands of an operator in which the usual arithmetic
conversions are performed shall have the same essential
type category.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
This commit is contained in:
Flavio Ceolin 2021-04-02 23:03:43 -07:00 committed by Anas Nashif
commit d0dac69fa9
3 changed files with 8 additions and 8 deletions

View file

@ -381,7 +381,7 @@ static int cmd_log_strdup_utilization(const struct shell *shell,
uint32_t buf_cnt = log_get_strdup_pool_utilization();
uint32_t buf_size = log_get_strdup_longest_string();
uint32_t percent = CONFIG_LOG_STRDUP_BUF_COUNT ?
100 * buf_cnt / CONFIG_LOG_STRDUP_BUF_COUNT : 0;
buf_cnt * 100U / CONFIG_LOG_STRDUP_BUF_COUNT : 0U;
shell_print(shell,
"Maximal utilization of the buffer pool: %d / %d (%d %%).",

View file

@ -89,8 +89,8 @@ uint32_t z_log_get_s_mask(const char *str, uint32_t nargs)
{
char curr;
bool arm = false;
uint32_t arg = 0;
uint32_t mask = 0;
uint32_t arg = 0U;
uint32_t mask = 0U;
__ASSERT_NO_MSG(nargs <= 8*sizeof(mask));
@ -500,7 +500,7 @@ void log_core_init(void)
/* Set default timestamp. */
if (sys_clock_hw_cycles_per_sec() > 1000000) {
timestamp_func = k_uptime_get_32;
freq = 1000;
freq = 1000U;
} else {
timestamp_func = k_cycle_get_32_wrapper;
freq = sys_clock_hw_cycles_per_sec();

View file

@ -109,13 +109,13 @@ static void msg_free(struct log_msg *msg)
/* Free any transient string found in arguments. */
if (log_msg_is_std(msg) && nargs) {
uint32_t i;
uint32_t smask = 0;
uint32_t smask = 0U;
for (i = 0; i < nargs; i++) {
for (i = 0U; i < nargs; i++) {
void *buf = (void *)log_msg_arg_get(msg, i);
if (log_is_strdup(buf)) {
if (smask == 0) {
if (smask == 0U) {
/* Do string arguments scan only when
* string duplication candidate detected
* since it is time consuming and free
@ -125,7 +125,7 @@ static void msg_free(struct log_msg *msg)
smask = z_log_get_s_mask(
log_msg_str_get(msg),
nargs);
if (smask == 0) {
if (smask == 0U) {
/* if no string argument is
* detected then stop searching
* for candidates.