This is an automated email from Gerrit.

"Richard Pasek <rpa...@google.com>" just uploaded a new patch set to Gerrit, 
which you can find at https://review.openocd.org/c/openocd/+/8730

-- gerrit

commit 62e319baa148c11dd3499fc282df27887c5819f1
Author: Richard Pasek <rpa...@google.com>
Date:   Thu Jan 30 05:38:08 2025 -0500

    driver/linuxspidev: Clear queue on allocation
    
    SWD idle clocks are added to the queue by advancing the queue index
    assuming the queue is zeroed. If the queue isn't zeroed, these idle
    clocks end up being filled with junk data. Lets clear the queue and
    associated buffers on queue allocation.
    
    Signed-off-by: Richard Pasek <rpa...@google.com>
    Change-Id: Ie660c10c27c4d0937ab0629138935ddbf5aeb0ae

diff --git a/src/jtag/drivers/linuxspidev.c b/src/jtag/drivers/linuxspidev.c
index 737d2bef83..1449aacb7b 100644
--- a/src/jtag/drivers/linuxspidev.c
+++ b/src/jtag/drivers/linuxspidev.c
@@ -233,7 +233,7 @@ static void spidev_free_queue(void)
 static int spidev_alloc_queue(unsigned int new_queue_entries)
 {
        if (queue_fill || queue_buf_fill) {
-               LOG_ERROR("Can't realloc allocate queue when queue is in use");
+               LOG_ERROR("Can't realloc queue when queue is in use");
                return ERROR_FAIL;
        }
 
@@ -243,18 +243,22 @@ static int spidev_alloc_queue(unsigned int 
new_queue_entries)
        queue_infos = realloc(queue_infos, sizeof(struct queue_info) * 
new_queue_entries);
        if (!queue_infos)
                goto realloc_fail;
+       memset(queue_infos, 0, sizeof(struct queue_info) * new_queue_entries);
 
        queue_tx_buf = realloc(queue_tx_buf, new_queue_buf_size);
        if (!queue_tx_buf)
                goto realloc_fail;
+       memset(queue_tx_buf, 0, new_queue_buf_size);
 
        queue_rx_buf = realloc(queue_rx_buf, new_queue_buf_size);
        if (!queue_rx_buf)
                goto realloc_fail;
+       memset(queue_rx_buf, 0, new_queue_buf_size);
 
        tx_flip_buf = realloc(tx_flip_buf, new_queue_buf_size);
        if (!tx_flip_buf)
                goto realloc_fail;
+       memset(tx_flip_buf, 0, new_queue_buf_size);
 
        max_queue_entries = new_queue_entries;
        queue_buf_size = new_queue_buf_size;

-- 

Reply via email to