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:
@@ -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)) {
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user