openocd: fix simple cases of Yoda condition
[openocd.git] / src / target / nds32_v3_common.c
index 271ffdd1cebdcc33dfa9bb700f337a420ac4d687..3abb3b9da2e791e0630dfb5abedcf9ec67c58e2c 100644 (file)
@@ -268,8 +268,8 @@ static int nds32_v3_get_exception_address(struct nds32 *nds32,
 
                nds32_get_mapped_reg(nds32, PC, &val_pc);
 
-               if ((NDS32_DEBUG_DATA_ADDR_WATCHPOINT_NEXT_PRECISE == reason) ||
-                               (NDS32_DEBUG_DATA_VALUE_WATCHPOINT_NEXT_PRECISE == reason)) {
+               if ((reason == NDS32_DEBUG_DATA_ADDR_WATCHPOINT_NEXT_PRECISE) ||
+                               (reason == NDS32_DEBUG_DATA_VALUE_WATCHPOINT_NEXT_PRECISE)) {
                        if (edmsw & 0x4) /* check EDMSW.IS_16BIT */
                                val_pc -= 2;
                        else
@@ -320,7 +320,7 @@ static int nds32_v3_get_exception_address(struct nds32 *nds32,
                        return ERROR_FAIL;
        } else if (match_count == 0) {
                /* global stop is precise exception */
-               if ((NDS32_DEBUG_LOAD_STORE_GLOBAL_STOP == reason) && nds32->global_stop) {
+               if ((reason == NDS32_DEBUG_LOAD_STORE_GLOBAL_STOP) && nds32->global_stop) {
                        /* parse instruction to get correct access address */
                        uint32_t val_pc;
                        uint32_t opcode;
@@ -553,7 +553,7 @@ int nds32_v3_write_buffer(struct target *target, target_addr_t address,
                int result;
                result = nds32_gdb_fileio_write_memory(nds32, address, size, buffer);
 
-               if (NDS_MEMORY_ACC_CPU == origin_access_channel) {
+               if (origin_access_channel == NDS_MEMORY_ACC_CPU) {
                        memory->access_channel = NDS_MEMORY_ACC_CPU;
                        aice_memory_access(aice, NDS_MEMORY_ACC_CPU);
                }

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)