openocd: fix simple cases of Yoda condition
[openocd.git] / src / target / nds32_v2.c
index 392bd6eb99fec41c77e713c9d6b71d90593f5123..8916a59e080182e680708637b3125ac46f11b47f 100644 (file)
@@ -37,35 +37,35 @@ static int nds32_v2_register_mapping(struct nds32 *nds32, int reg_no)
        uint32_t cur_level = nds32->current_interrupt_level;
 
        if ((1 <= cur_level) && (cur_level < max_level)) {
-               if (IR0 == reg_no) {
+               if (reg_no == IR0) {
                        LOG_DEBUG("Map PSW to IPSW");
                        return IR1;
-               } else if (PC == reg_no) {
+               } else if (reg_no == PC) {
                        LOG_DEBUG("Map PC to IPC");
                        return IR9;
                }
        } else if ((2 <= cur_level) && (cur_level < max_level)) {
-               if (R26 == reg_no) {
+               if (reg_no == R26) {
                        LOG_DEBUG("Mapping P0 to P_P0");
                        return IR12;
-               } else if (R27 == reg_no) {
+               } else if (reg_no == R27) {
                        LOG_DEBUG("Mapping P1 to P_P1");
                        return IR13;
-               } else if (IR1 == reg_no) {
+               } else if (reg_no == IR1) {
                        LOG_DEBUG("Mapping IPSW to P_IPSW");
                        return IR2;
-               } else if (IR4 == reg_no) {
+               } else if (reg_no == IR4) {
                        LOG_DEBUG("Mapping EVA to P_EVA");
                        return IR5;
-               } else if (IR6 == reg_no) {
+               } else if (reg_no == IR6) {
                        LOG_DEBUG("Mapping ITYPE to P_ITYPE");
                        return IR7;
-               } else if (IR9 == reg_no) {
+               } else if (reg_no == IR9) {
                        LOG_DEBUG("Mapping IPC to P_IPC");
                        return IR10;
                }
        } else if (cur_level == max_level) {
-               if (PC == reg_no) {
+               if (reg_no == PC) {
                        LOG_DEBUG("Mapping PC to O_IPC");
                        return IR11;
                }
@@ -436,7 +436,7 @@ static int nds32_v2_add_breakpoint(struct target *target,
                return ERROR_OK;
        } else if (breakpoint->type == BKPT_SOFT) {
                result = nds32_add_software_breakpoint(target, breakpoint);
-               if (ERROR_OK != result) {
+               if (result != ERROR_OK) {
                        /* auto convert to hardware breakpoint if failed */
                        if (nds32->auto_convert_hw_bp) {
                                /* convert to hardware breakpoint */

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)