target/espressif: fix clang report on use of garbage value
When the function xtensa_queue_dbg_reg_read() returns error, the
array 'tmp' remains not initialized and scan-build complains while
computing buf_get_u32() that:
Result of operation is garbage or undefined
Check the returned value of xtensa_queue_dbg_reg_read() and
propagate it.
Change-Id: If0aaad068b97ef0a76560e262d16429afd469585
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 8d1dcf293a
("target/espressif: add application tracing functionality over JTAG")
Reviewed-on: https://review.openocd.org/c/openocd/+/7607
Tested-by: jenkins
Reviewed-by: Erhan Kurubas <erhan.kurubas@espressif.com>
This commit is contained in:
parent
bb073f897c
commit
c1dc7935f7
|
@ -242,9 +242,11 @@ int esp_xtensa_apptrace_status_reg_read(struct target *target, uint32_t *stat)
|
|||
struct xtensa *xtensa = target_to_xtensa(target);
|
||||
uint8_t tmp[4];
|
||||
|
||||
xtensa_queue_dbg_reg_read(xtensa, XTENSA_APPTRACE_STAT_REG, tmp);
|
||||
int res = xtensa_queue_dbg_reg_read(xtensa, XTENSA_APPTRACE_STAT_REG, tmp);
|
||||
if (res != ERROR_OK)
|
||||
return res;
|
||||
xtensa_dm_queue_tdi_idle(&xtensa->dbg_mod);
|
||||
int res = xtensa_dm_queue_execute(&xtensa->dbg_mod);
|
||||
res = xtensa_dm_queue_execute(&xtensa->dbg_mod);
|
||||
if (res != ERROR_OK) {
|
||||
LOG_ERROR("Failed to exec JTAG queue!");
|
||||
return res;
|
||||
|
|
Loading…
Reference in New Issue