aboutsummaryrefslogtreecommitdiff
path: root/src/svf
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2021-07-03 16:47:35 +0200
committerAntonio Borneo <borneo.antonio@gmail.com>2021-07-20 14:55:24 +0100
commit28c24a5c41c47a66e9310912f88148814f730a25 (patch)
tree803cf52a0c8f5a0687f5c7fef402b08cf337ebac /src/svf
parentbba48b057cdc4f26721e06a5310652dcf0e55873 (diff)
downloadriscv-openocd-28c24a5c41c47a66e9310912f88148814f730a25.zip
riscv-openocd-28c24a5c41c47a66e9310912f88148814f730a25.tar.gz
riscv-openocd-28c24a5c41c47a66e9310912f88148814f730a25.tar.bz2
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>
Diffstat (limited to 'src/svf')
-rw-r--r--src/svf/svf.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/svf/svf.c b/src/svf/svf.c
index 482dcdc..10ad7e7 100644
--- a/src/svf/svf.c
+++ b/src/svf/svf.c
@@ -569,7 +569,7 @@ free_all:
svf_free_xxd_para(&svf_para.sdr_para);
svf_free_xxd_para(&svf_para.sir_para);
- if (ERROR_OK == ret)
+ if (ret == ERROR_OK)
command_print(CMD,
"svf file programmed %s for %d commands with %d errors",
(svf_ignore_error > 1) ? "unsuccessfully" : "successfully",
@@ -742,8 +742,8 @@ parse_char:
bool svf_tap_state_is_stable(tap_state_t state)
{
- return (TAP_RESET == state) || (TAP_IDLE == state)
- || (TAP_DRPAUSE == state) || (TAP_IRPAUSE == state);
+ return (state == TAP_RESET) || (state == TAP_IDLE)
+ || (state == TAP_DRPAUSE) || (state == TAP_IRPAUSE);
}
static int svf_find_string_in_array(char *str, char **strs, int num_of_element)
@@ -1110,7 +1110,7 @@ xxr_common:
memset(xxr_para_tmp->mask, 0, (xxr_para_tmp->len + 7) >> 3);
}
/* do scan if necessary */
- if (SDR == command) {
+ if (command == SDR) {
/* check buffer size first, reallocate if necessary */
i = svf_para.hdr_para.len + svf_para.sdr_para.len +
svf_para.tdr_para.len;
@@ -1201,7 +1201,7 @@ xxr_common:
}
svf_buffer_index += (i + 7) >> 3;
- } else if (SIR == command) {
+ } else if (command == SIR) {
/* check buffer size first, reallocate if necessary */
i = svf_para.hir_para.len + svf_para.sir_para.len +
svf_para.tir_para.len;
@@ -1534,9 +1534,8 @@ xxr_common:
return ERROR_FAIL;
/* output debug info */
- if ((SIR == command) || (SDR == command)) {
+ if ((command == SIR) || (command == SDR))
SVF_BUF_LOG(DEBUG, svf_tdi_buffer, svf_check_tdo_para[0].bit_len, "TDO read");
- }
}
} else {
/* for fast executing, execute tap if necessary */