This is an automated email from Gerrit.

"Tomas Vanek <van...@fbl.cz>" just uploaded a new patch set to Gerrit, which 
you can find at https://review.openocd.org/c/openocd/+/7361

-- gerrit

commit 2089120f92a42fb5877010fe5f9813cc6699fd45
Author: Tomas Vanek <van...@fbl.cz>
Date:   Sat Nov 19 07:08:32 2022 +0100

    jtag/drivers/cmsis_dap: use dap parameter instead of cmsis_dap_handle
    
    Replace the direct dereference of cmsis_dap_handle by dereference
    of the dap function parameter wherever possible.
    
    Signed-off-by: Tomas Vanek <van...@fbl.cz>
    Change-Id: I32601dbe0270267642720a8524706aa76d187c3b

diff --git a/src/jtag/drivers/cmsis_dap.c b/src/jtag/drivers/cmsis_dap.c
index 04fc42362f..4f68da204c 100644
--- a/src/jtag/drivers/cmsis_dap.c
+++ b/src/jtag/drivers/cmsis_dap.c
@@ -291,14 +291,15 @@ static void cmsis_dap_close(struct cmsis_dap *dap)
                dap->backend = NULL;
        }
 
-       free(cmsis_dap_handle->packet_buffer);
-       free(cmsis_dap_handle);
-       cmsis_dap_handle = NULL;
+       free(dap->packet_buffer);
 
        for (int i = 0; i < MAX_PENDING_REQUESTS; i++) {
                free(dap->pending_fifo[i].transfers);
                dap->pending_fifo[i].transfers = NULL;
        }
+
+       free(cmsis_dap_handle);
+       cmsis_dap_handle = NULL;
 }
 
 static void cmsis_dap_flush_read(struct cmsis_dap *dap)
@@ -329,7 +330,7 @@ static int cmsis_dap_xfer(struct cmsis_dap *dap, int txlen)
                dap->pending_fifo_get_idx = 0;
        }
 
-       uint8_t current_cmd = cmsis_dap_handle->command[0];
+       uint8_t current_cmd = dap->command[0];
        int retval = dap->backend->write(dap, txlen, LIBUSB_TIMEOUT_MS);
        if (retval < 0)
                return retval;
@@ -339,7 +340,7 @@ static int cmsis_dap_xfer(struct cmsis_dap *dap, int txlen)
        if (retval < 0)
                return retval;
 
-       uint8_t *resp = cmsis_dap_handle->response;
+       uint8_t *resp = dap->response;
        if (resp[0] == DAP_ERROR) {
                LOG_ERROR("CMSIS-DAP command 0x%" PRIx8 " not implemented", 
current_cmd);
                return ERROR_NOT_IMPLEMENTED;
@@ -744,7 +745,7 @@ static int cmsis_dap_cmd_dap_swo_data(
 
 static void cmsis_dap_swd_write_from_queue(struct cmsis_dap *dap)
 {
-       uint8_t *command = cmsis_dap_handle->command;
+       uint8_t *command = dap->command;
        struct pending_request_block *block = 
&dap->pending_fifo[dap->pending_fifo_put_idx];
 
        LOG_DEBUG_IO("Executing %d queued transactions from FIFO index %u",

-- 

Reply via email to