This is an automated email from Gerrit.

"Kendall Goto <[email protected]>" just uploaded a new patch set to Gerrit, which you 
can find at https://review.openocd.org/c/openocd/+/9570

-- gerrit

commit 8763aaebd28653eaf21e1f39bf9c83f2a93377fa
Author: Kendall Goto <[email protected]>
Date:   Wed Apr 8 11:19:08 2026 -0700

    transport: add cleanup function to reset allowed_transport and session
    
    Support cleaning up the global state (allowed_transports bitmask, session
    pointer) of transport so that a new transport can be allowed / selected.
    Call the clean-up function during adapter_quit
    
    Change-Id: I49e76c5b592cc0fa768cad28cc8822b7578b287e
    Signed-off-by: Kendall Goto <[email protected]>

diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c
index 7bf049cd86..0f854f5161 100644
--- a/src/jtag/adapter.c
+++ b/src/jtag/adapter.c
@@ -204,6 +204,8 @@ int adapter_quit(void)
                t = n;
        }
 
+       transport_cleanup();
+
        return ERROR_OK;
 }
 
diff --git a/src/transport/transport.c b/src/transport/transport.c
index bb7df408ca..4c8538039a 100644
--- a/src/transport/transport.c
+++ b/src/transport/transport.c
@@ -263,6 +263,12 @@ const char *get_current_transport_name(void)
        return transport_full_name(session->id);
 }
 
+void transport_cleanup(void)
+{
+       allowed_transports = 0;
+       session = NULL;
+}
+
 /*-----------------------------------------------------------------------*/
 
 /*
diff --git a/src/transport/transport.h b/src/transport/transport.h
index 5445bcf3b2..664a02a491 100644
--- a/src/transport/transport.h
+++ b/src/transport/transport.h
@@ -109,6 +109,8 @@ bool transport_is_dapdirect_jtag(void);
 bool transport_is_dapdirect_swd(void);
 bool transport_is_swim(void);
 
+void transport_cleanup(void);
+
 #if BUILD_HLADAPTER
 bool transport_is_hla(void);
 #else

-- 

Reply via email to