Laurentiu Cocanu - memory read/write and exit() error path fixes
[openocd.git] / src / target / etm.c
index b07f1a75ae2ef95268229bcaa83c4ed7e420b916..c3750557d032a4b619ef352c3615c0f9171ac920 100644 (file)
@@ -311,15 +311,17 @@ int etm_setup(target_t *target)
 
 int etm_get_reg(reg_t *reg)
 {
-       if (etm_read_reg(reg) != ERROR_OK)
+       int retval;
+       if ((retval = etm_read_reg(reg)) != ERROR_OK)
        {
                LOG_ERROR("BUG: error scheduling etm register read");
-               exit(-1);
+               return retval;
        }
 
-       if (jtag_execute_queue() != ERROR_OK)
+       if ((retval = jtag_execute_queue()) != ERROR_OK)
        {
                LOG_ERROR("register read failed");
+               return retval;
        }
 
        return ERROR_OK;
@@ -389,10 +391,11 @@ int etm_read_reg(reg_t *reg)
 
 int etm_set_reg(reg_t *reg, u32 value)
 {
-       if (etm_write_reg(reg, value) != ERROR_OK)
+       int retval;
+       if ((retval = etm_write_reg(reg, value)) != ERROR_OK)
        {
                LOG_ERROR("BUG: error scheduling etm register write");
-               exit(-1);
+               return retval;
        }
 
        buf_set_u32(reg->value, 0, reg->size, value);
@@ -404,12 +407,13 @@ int etm_set_reg(reg_t *reg, u32 value)
 
 int etm_set_reg_w_exec(reg_t *reg, u8 *buf)
 {
+       int retval;
        etm_set_reg(reg, buf_get_u32(buf, 0, reg->size));
 
-       if (jtag_execute_queue() != ERROR_OK)
+       if ((retval = jtag_execute_queue()) != ERROR_OK)
        {
                LOG_ERROR("register write failed");
-               exit(-1);
+               return retval;
        }
        return ERROR_OK;
 }

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)