From: OpenOCD-Gerrit <ope...@us...> - 2021-10-25 16:09:22
|
This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Main OpenOCD repository". The branch, master has been updated via 57262ebeae7be08ba260c36bb11630e03e594856 (commit) via b3f052ba9d9582fe203ff8baa73fef66c02196ac (commit) from 9188115296917ce74ad5b0f83451414735225ce5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 57262ebeae7be08ba260c36bb11630e03e594856 Author: Antonio Borneo <bor...@gm...> Date: Wed Sep 22 18:51:26 2021 +0200 arm_tpiu_swo: fix two dead assignments Clang scan-build complains for two dead assignments: Value stored to 'retval' is never read Since the timer callback should not return error, print an error message if the data cannot be send out. Add a FIXME comment because in current code there is no string/name to report which connection has failed. In command tpiu enable check the returned value and propagate the error. Change-Id: I9a89e4c4f7b677e8222b2df09a31b2478ac9ca4f Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: https://review.openocd.org/c/openocd/+/6588 Tested-by: jenkins diff --git a/src/target/arm_tpiu_swo.c b/src/target/arm_tpiu_swo.c index f2b514826..024521364 100644 --- a/src/target/arm_tpiu_swo.c +++ b/src/target/arm_tpiu_swo.c @@ -155,7 +155,7 @@ static int arm_tpiu_swo_poll_trace(void *priv) if (obj->out_filename && obj->out_filename[0] == ':') list_for_each_entry(c, &obj->connections, lh) if (connection_write(c->connection, buf, size) != (int)size) - retval = ERROR_FAIL; + LOG_ERROR("Error writing to connection"); /* FIXME: which connection? */ return ERROR_OK; } @@ -678,6 +678,10 @@ static int jim_arm_tpiu_swo_enable(Jim_Interp *interp, int argc, Jim_Obj *const if (obj->pin_protocol == TPIU_SPPR_PROTOCOL_SYNC) { retval = wrap_read_u32(target, tpiu_ap, obj->spot.base + TPIU_SSPSR_OFFSET, &value); + if (retval != ERROR_OK) { + LOG_ERROR("Cannot read TPIU register SSPSR"); + return JIM_ERR; + } if (!(value & BIT(obj->port_width - 1))) { LOG_ERROR("TPIU does not support port-width of %d bits", obj->port_width); return JIM_ERR; commit b3f052ba9d9582fe203ff8baa73fef66c02196ac Author: Antonio Borneo <bor...@gm...> Date: Wed Sep 22 18:39:57 2021 +0200 jtag/core: fix unused assignment Clang scan-build complains about a variable assigned but never used. Although the value stored to 'val' is used in the enclosing expression, the value is never actually read from 'val' Remove the dead assignment. While there, reduce the scope of the variable by declaring the variable at the point of first use. Change-Id: Ibe2b55a7d70597833cfa7f3d843e7c3d2407f2df Signed-off-by: Antonio Borneo <bor...@gm...> Reviewed-on: https://review.openocd.org/c/openocd/+/6587 Tested-by: jenkins diff --git a/src/jtag/core.c b/src/jtag/core.c index 7da2a6c35..51875a00a 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -1336,7 +1336,6 @@ static int jtag_validate_ircapture(void) struct jtag_tap *tap; uint8_t *ir_test = NULL; struct scan_field field; - uint64_t val; int chain_pos = 0; int retval; @@ -1396,7 +1395,7 @@ static int jtag_validate_ircapture(void) */ if (tap->ir_length == 0) { tap->ir_length = 2; - while ((val = buf_get_u64(ir_test, chain_pos, tap->ir_length + 1)) == 1 + while (buf_get_u64(ir_test, chain_pos, tap->ir_length + 1) == 1 && tap->ir_length < JTAG_IRLEN_MAX) { tap->ir_length++; } @@ -1412,7 +1411,7 @@ static int jtag_validate_ircapture(void) * this part of the JTAG spec, so their capture mask/value * attributes might disable this test. */ - val = buf_get_u64(ir_test, chain_pos, tap->ir_length); + uint64_t val = buf_get_u64(ir_test, chain_pos, tap->ir_length); if ((val & tap->ir_capture_mask) != tap->ir_capture_value) { LOG_ERROR("%s: IR capture error; saw 0x%0*" PRIx64 " not 0x%0*" PRIx32, jtag_tap_name(tap), @@ -1428,7 +1427,7 @@ static int jtag_validate_ircapture(void) } /* verify the '11' sentinel we wrote is returned at the end */ - val = buf_get_u64(ir_test, chain_pos, 2); + uint64_t val = buf_get_u64(ir_test, chain_pos, 2); if (val != 0x3) { char *cbuf = buf_to_hex_str(ir_test, total_ir_length); ----------------------------------------------------------------------- Summary of changes: src/jtag/core.c | 7 +++---- src/target/arm_tpiu_swo.c | 6 +++++- 2 files changed, 8 insertions(+), 5 deletions(-) hooks/post-receive -- Main OpenOCD repository |