target/target: fix clang static analyzer warnings
[fw/openocd] / src / target / armv8.c
index 76a2d98af8c9639765beb9017da5a2ada110bddf..e7369372ab711ed1a95e075818827194bd897f93 100644 (file)
@@ -646,7 +646,7 @@ int armv8_read_mpidr(struct armv8_common *armv8)
        retval = dpm->instr_read_data_r0(dpm, armv8_opcode(armv8, READ_REG_MPIDR), &mpidr);
        if (retval != ERROR_OK)
                goto done;
-       if (mpidr & 1<<31) {
+       if (mpidr & 1U<<31) {
                armv8->multi_processor_system = (mpidr >> 30) & 1;
                armv8->cluster_id = (mpidr >> 8) & 0xf;
                armv8->cpu_id = mpidr & 0x3;
@@ -678,8 +678,8 @@ void armv8_set_cpsr(struct arm *arm, uint32_t cpsr)
         */
        if (arm->cpsr) {
                buf_set_u32(arm->cpsr->value, 0, 32, cpsr);
-               arm->cpsr->valid = 1;
-               arm->cpsr->dirty = 0;
+               arm->cpsr->valid = true;
+               arm->cpsr->dirty = false;
        }
 
        /* Older ARMs won't have the J bit */
@@ -1054,7 +1054,7 @@ COMMAND_HANDLER(armv8_handle_exception_catch_command)
                        return ERROR_FAIL;
                }
 
-               command_print(CMD_CTX, "Exception Catch: Secure: %s, Non-Secure: %s", sec, nsec);
+               command_print(CMD, "Exception Catch: Secure: %s, Non-Secure: %s", sec, nsec);
                return ERROR_OK;
        }
 
@@ -1079,16 +1079,16 @@ COMMAND_HANDLER(armv8_handle_exception_catch_command)
        return ERROR_OK;
 }
 
-int armv8_handle_cache_info_command(struct command_context *cmd_ctx,
+int armv8_handle_cache_info_command(struct command_invocation *cmd,
        struct armv8_cache_common *armv8_cache)
 {
        if (armv8_cache->info == -1) {
-               command_print(cmd_ctx, "cache not yet identified");
+               command_print(cmd, "cache not yet identified");
                return ERROR_OK;
        }
 
        if (armv8_cache->display_cache_info)
-               armv8_cache->display_cache_info(cmd_ctx, armv8_cache);
+               armv8_cache->display_cache_info(cmd, armv8_cache);
        return ERROR_OK;
 }
 
@@ -1518,17 +1518,17 @@ static int armv8_set_core_reg(struct reg *reg, uint8_t *buf)
                        armv8_set_cpsr(arm, (uint32_t)value);
                else {
                        buf_set_u64(reg->value, 0, reg->size, value);
-                       reg->valid = 1;
+                       reg->valid = true;
                }
        } else if (reg->size <= 128) {
                uint64_t hvalue = buf_get_u64(buf + 8, 0, reg->size - 64);
 
                buf_set_u64(reg->value, 0, 64, value);
                buf_set_u64(reg->value + 8, 0, reg->size - 64, hvalue);
-               reg->valid = 1;
+               reg->valid = true;
        }
 
-       reg->dirty = 1;
+       reg->dirty = true;
 
        return ERROR_OK;
 }
@@ -1585,11 +1585,11 @@ static int armv8_set_core_reg32(struct reg *reg, uint8_t *buf)
                        uint64_t value64 = buf_get_u64(buf, 0, 64);
                        buf_set_u64(reg->value, 0, 64, value64);
                }
-               reg->valid = 1;
-               reg64->valid = 1;
+               reg->valid = true;
+               reg64->valid = true;
        }
 
-       reg64->dirty = 1;
+       reg64->dirty = true;
 
        return ERROR_OK;
 }