openocd: fix Yoda conditions with checkpatch

The new checkpatch can automatically fix the code, but this
feature is still error prone and not complete.

Patch generated automatically through the new checkpatch with
flags "--types CONSTANT_COMPARISON --fix-inplace".

Some Yoda condition is detected by checkpatch but not fixed; it
will be fixed manually in a following commit.

Change-Id: Ifaaa1159e63dbd1db6aa3c017125df9874fa9703
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6355
Tested-by: jenkins
This commit is contained in:
Antonio Borneo
2021-07-03 17:18:53 +02:00
parent 54e699b260
commit c0c7d6fe8b
34 changed files with 233 additions and 233 deletions

View File

@@ -121,7 +121,7 @@ static int embkernel_create(struct target *target)
{
size_t i = 0;
while ((i < ARRAY_SIZE(embkernel_params_list)) &&
(0 != strcmp(embkernel_params_list[i].target_name, target->type->name)))
(strcmp(embkernel_params_list[i].target_name, target->type->name) != 0))
i++;
if (i >= ARRAY_SIZE(embkernel_params_list)) {

View File

@@ -260,7 +260,7 @@ static int mqx_create(
{
/* check target name against supported architectures */
for (unsigned int i = 0; i < ARRAY_SIZE(mqx_params_list); i++) {
if (0 == strcmp(mqx_params_list[i].target_name, target->type->name)) {
if (strcmp(mqx_params_list[i].target_name, target->type->name) == 0) {
target->rtos->rtos_specific_params = (void *)&mqx_params_list[i];
/* LOG_DEBUG("MQX RTOS - valid architecture: %s", target->type->name); */
return 0;
@@ -291,7 +291,7 @@ static int mqx_update_threads(
/* clear old data */
rtos_free_threadlist(rtos);
/* check scheduler */
if (ERROR_OK != mqx_is_scheduler_running(rtos))
if (mqx_is_scheduler_running(rtos) != ERROR_OK)
return ERROR_FAIL;
/* get kernel_data symbol */
if (mqx_get_symbol(rtos, MQX_VAL_MQX_KERNEL_DATA, &kernel_data_addr) != ERROR_OK)
@@ -438,7 +438,7 @@ static int mqx_get_thread_reg_list(
LOG_ERROR("MQX RTOS - invalid threadid: 0x%X", (int)thread_id);
return ERROR_FAIL;
}
if (ERROR_OK != mqx_is_scheduler_running(rtos))
if (mqx_is_scheduler_running(rtos) != ERROR_OK)
return ERROR_FAIL;
/* get kernel_data symbol */
if (mqx_get_symbol(rtos, MQX_VAL_MQX_KERNEL_DATA, &kernel_data_addr) != ERROR_OK)

View File

@@ -401,7 +401,7 @@ static int riot_create(struct target *target)
/* lookup if target is supported by RIOT */
while ((i < RIOT_NUM_PARAMS) &&
(0 != strcmp(riot_params_list[i].target_name, target->type->name))) {
(strcmp(riot_params_list[i].target_name, target->type->name) != 0)) {
i++;
}
if (i >= RIOT_NUM_PARAMS) {

View File

@@ -152,7 +152,7 @@ int rtos_create(struct jim_getopt_info *goi, struct target *target)
}
for (x = 0; rtos_types[x]; x++)
if (0 == strcmp(cp, rtos_types[x]->name))
if (strcmp(cp, rtos_types[x]->name) == 0)
return os_alloc_create(target, rtos_types[x]);
Jim_SetResultFormatted(goi->interp, "Unknown RTOS type %s, try one of: ", cp);