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/+/7657

-- gerrit

commit 95d073dcee732898d4805a01cbe2c7012e5c0949
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Sat May 6 10:34:13 2023 +0200

    pld/virtex2: check error propagated by virtex2_read_stat()
    
    Commit dd9137dc0e0c ("pld/virtex2: add missing error checks") adds
    checks on the return value of several functions, allowing also
    virtex2_read_stat() to propagate such returned values.
    This triggers an error with clang, as it is now able to identify a
    possible execution path that makes uninitialized the variable
    status.
    
    Check for the returned value of virtex2_read_stat() before using
    the variable status and propagate the returned value.
    While there, drop a useless empty string.
    
    Change-Id: I7a23d3f904d4e07cdb6f6dfdf1179889b6b8afb8
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>

diff --git a/src/pld/virtex2.c b/src/pld/virtex2.c
index 3c174ae594..fd0725a63a 100644
--- a/src/pld/virtex2.c
+++ b/src/pld/virtex2.c
@@ -241,9 +241,13 @@ COMMAND_HANDLER(virtex2_handle_read_stat_command)
                return ERROR_FAIL;
        }
 
-       virtex2_read_stat(device, &status);
+       int retval = virtex2_read_stat(device, &status);
+       if (retval != ERROR_OK) {
+               command_print(CMD, "cannot read virtex2 status register");
+               return retval;
+       }
 
-       command_print(CMD, "virtex2 status register: 0x%8.8" PRIx32 "", status);
+       command_print(CMD, "virtex2 status register: 0x%8.8" PRIx32, status);
 
        return ERROR_OK;
 }

-- 

Reply via email to