Skip to content

Commit d0dac69

Browse files
Flavio Ceolinnashif
authored andcommitted
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 <[email protected]>
1 parent 9285b4c commit d0dac69

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

subsys/logging/log_cmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ static int cmd_log_strdup_utilization(const struct shell *shell,
381381
uint32_t buf_cnt = log_get_strdup_pool_utilization();
382382
uint32_t buf_size = log_get_strdup_longest_string();
383383
uint32_t percent = CONFIG_LOG_STRDUP_BUF_COUNT ?
384-
100 * buf_cnt / CONFIG_LOG_STRDUP_BUF_COUNT : 0;
384+
buf_cnt * 100U / CONFIG_LOG_STRDUP_BUF_COUNT : 0U;
385385

386386
shell_print(shell,
387387
"Maximal utilization of the buffer pool: %d / %d (%d %%).",

subsys/logging/log_core.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,8 @@ uint32_t z_log_get_s_mask(const char *str, uint32_t nargs)
8989
{
9090
char curr;
9191
bool arm = false;
92-
uint32_t arg = 0;
93-
uint32_t mask = 0;
92+
uint32_t arg = 0U;
93+
uint32_t mask = 0U;
9494

9595
__ASSERT_NO_MSG(nargs <= 8*sizeof(mask));
9696

@@ -500,7 +500,7 @@ void log_core_init(void)
500500
/* Set default timestamp. */
501501
if (sys_clock_hw_cycles_per_sec() > 1000000) {
502502
timestamp_func = k_uptime_get_32;
503-
freq = 1000;
503+
freq = 1000U;
504504
} else {
505505
timestamp_func = k_cycle_get_32_wrapper;
506506
freq = sys_clock_hw_cycles_per_sec();

subsys/logging/log_msg.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,13 @@ static void msg_free(struct log_msg *msg)
109109
/* Free any transient string found in arguments. */
110110
if (log_msg_is_std(msg) && nargs) {
111111
uint32_t i;
112-
uint32_t smask = 0;
112+
uint32_t smask = 0U;
113113

114-
for (i = 0; i < nargs; i++) {
114+
for (i = 0U; i < nargs; i++) {
115115
void *buf = (void *)log_msg_arg_get(msg, i);
116116

117117
if (log_is_strdup(buf)) {
118-
if (smask == 0) {
118+
if (smask == 0U) {
119119
/* Do string arguments scan only when
120120
* string duplication candidate detected
121121
* since it is time consuming and free
@@ -125,7 +125,7 @@ static void msg_free(struct log_msg *msg)
125125
smask = z_log_get_s_mask(
126126
log_msg_str_get(msg),
127127
nargs);
128-
if (smask == 0) {
128+
if (smask == 0U) {
129129
/* if no string argument is
130130
* detected then stop searching
131131
* for candidates.

0 commit comments

Comments
 (0)