openocd: fix simple cases of Yoda condition
[openocd.git] / src / target / nds32.c
index 372f82d0ca280c8232a29573a19c7b3d5f3ea1b5..184f2fecc67922b502135df9b229c7b0ba40ee8c 100644 (file)
@@ -330,16 +330,16 @@ static int nds32_set_core_reg(struct reg *reg, uint8_t *buf)
        reg->dirty = false;
 
        /* update registers to take effect right now */
-       if (IR0 == mapped_regnum) {
+       if (mapped_regnum == IR0) {
                nds32_update_psw(nds32);
-       } else if (MR0 == mapped_regnum) {
+       } else if (mapped_regnum == MR0) {
                nds32_update_mmu_info(nds32);
-       } else if ((MR6 == mapped_regnum) || (MR7 == mapped_regnum)) {
+       } else if ((mapped_regnum == MR6) || (mapped_regnum == MR7)) {
                /* update lm information */
                nds32_update_lm_info(nds32);
-       } else if (MR8 == mapped_regnum) {
+       } else if (mapped_regnum == MR8) {
                nds32_update_cache_info(nds32);
-       } else if (FUCPR == mapped_regnum) {
+       } else if (mapped_regnum == FUCPR) {
                /* update audio/fpu setting */
                nds32_check_extension(nds32);
        }
@@ -1951,7 +1951,7 @@ int nds32_examine_debug_reason(struct nds32 *nds32)
                                nds32_step_without_watchpoint(nds32);
 
                                /* before single_step, save exception address */
-                               if (ERROR_OK != result)
+                               if (result != ERROR_OK)
                                        return ERROR_FAIL;
 
                                target->debug_reason = DBG_REASON_WATCHPOINT;
@@ -2059,7 +2059,7 @@ int nds32_halt(struct target *target)
        if (nds32_target_state(nds32, &state) != ERROR_OK)
                return ERROR_FAIL;
 
-       if (TARGET_HALTED != state)
+       if (state != TARGET_HALTED)
                /* TODO: if state == TARGET_HALTED, check ETYPE is DBGI or not */
                if (ERROR_OK != aice_halt(aice))
                        return ERROR_FAIL;

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)