This is an automated email from Gerrit.

"Antonio Borneo <borneo.anto...@gmail.com>" just uploaded a new patch set to 
Gerrit, which you can find at https://review.openocd.org/c/openocd/+/7607

-- gerrit

commit 3d2ee13bc108778b01c46a7f94a04cc0c19c775c
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Sat Apr 15 00:21:42 2023 +0200

    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.anto...@gmail.com>
    Fixes: 8d1dcf293a0c ("target/espressif: add application tracing 
functionality over JTAG")

diff --git a/src/target/espressif/esp_xtensa_apptrace.c 
b/src/target/espressif/esp_xtensa_apptrace.c
index dfb846da07..5741ab0308 100644
--- a/src/target/espressif/esp_xtensa_apptrace.c
+++ b/src/target/espressif/esp_xtensa_apptrace.c
@@ -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;

-- 

Reply via email to