forked from auracaster/openocd
openocd: fix simple cases of Yoda condition
There are ~900 Yoda conditions to be aligned to the coding style.
For recurrent Yoda conditions it's preferable using a trivial
script in order to minimize the review effort.
E.g. comparison of uppercase macro/enum with lowercase variable:
- ...(ERROR_OK == retval)...
+ ...(retval == ERROR_OK)...
Patch generated automatically with the command:
sed -i \
's/(\([A-Z][A-Z0-9_]*\) \([=!]=\) \([a-z][a-z0-9_]*\))/(\3 \2 \1)/g' \
$(find src/ -type f)
While there, remove the braces {} around a single statement block
to prevent warning from checkpatch.
Change-Id: If585b0a4b4578879c87b2dd74d9e0025e275ec6b
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6354
Tested-by: jenkins
Reviewed-by: Xiang W <wxjstz@126.com>
This commit is contained in:
@@ -768,7 +768,7 @@ COMMAND_HANDLER(max32xxx_handle_mass_erase_command)
|
||||
return ERROR_OK;
|
||||
}
|
||||
|
||||
if (ERROR_OK != retval)
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
|
||||
if (max32xxx_mass_erase(bank) == ERROR_OK) {
|
||||
@@ -796,7 +796,7 @@ COMMAND_HANDLER(max32xxx_handle_protection_set_command)
|
||||
}
|
||||
|
||||
retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
|
||||
if (ERROR_OK != retval)
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
info = bank->driver_priv;
|
||||
|
||||
@@ -852,7 +852,7 @@ COMMAND_HANDLER(max32xxx_handle_protection_clr_command)
|
||||
}
|
||||
|
||||
retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
|
||||
if (ERROR_OK != retval)
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
info = bank->driver_priv;
|
||||
|
||||
@@ -907,13 +907,13 @@ COMMAND_HANDLER(max32xxx_handle_protection_check_command)
|
||||
}
|
||||
|
||||
retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
|
||||
if (ERROR_OK != retval)
|
||||
if (retval != ERROR_OK)
|
||||
return retval;
|
||||
info = bank->driver_priv;
|
||||
|
||||
/* Update the protection array */
|
||||
retval = max32xxx_protect_check(bank);
|
||||
if (ERROR_OK != retval) {
|
||||
if (retval != ERROR_OK) {
|
||||
LOG_WARNING("Error updating the protection array");
|
||||
return retval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user