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

-- gerrit

commit 53d2ebca29c9914e2aa0c1c16b773eb7b6db03c8
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Wed Jun 1 19:47:48 2022 +0200

    drivers/bitbang: silence scan-build warning
    
    The array is partially initialized with buf_set_u32(,5,32,), then
    the rest of the array is read from SWD.
    But scan-build report the array to have garbage content after the
    initialization, due to the offset of 5 bit that only inits part of
    the first byte.
    
    Silence the false positive from scan-build by initializing the
    array.
    
    Change-Id: Ic38d50280f67939e3ec5fa05741f66d5f993f8c2
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>

diff --git a/src/jtag/drivers/bitbang.c b/src/jtag/drivers/bitbang.c
index 898d6d3df9..78dcb2947d 100644
--- a/src/jtag/drivers/bitbang.c
+++ b/src/jtag/drivers/bitbang.c
@@ -532,8 +532,9 @@ static void bitbang_swd_write_reg(uint8_t cmd, uint32_t 
value, uint32_t ap_delay
        /* Devices do not reply to DP_TARGETSEL write cmd, ignore received ack 
*/
        bool check_ack = swd_cmd_returns_ack(cmd);
 
+       /* init the array to silence scan-build */
+       uint8_t trn_ack_data_parity_trn[DIV_ROUND_UP(4 + 3 + 32 + 1 + 4, 8)] = 
{0};
        for (;;) {
-               uint8_t trn_ack_data_parity_trn[DIV_ROUND_UP(4 + 3 + 32 + 1 + 
4, 8)];
                buf_set_u32(trn_ack_data_parity_trn, 1 + 3 + 1, 32, value);
                buf_set_u32(trn_ack_data_parity_trn, 1 + 3 + 1 + 32, 1, 
parity_u32(value));
 

-- 

Reply via email to