openocd: fix simple cases of Yoda condition
[openocd.git] / src / svf / svf.c
index 482dcdc0da5ebe1dc2c54bc40c980c517803d854..10ad7e7136dd324cfd7e566792d922b4e830b435 100644 (file)
@@ -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 */

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)