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

-- gerrit

commit 73cf0e3c902fae787ae25c57c3a100e78497b059
Author: Antonio Borneo <borneo.anto...@gmail.com>
Date:   Thu May 1 19:38:42 2025 +0200

    transport: fix incorrect statement
    
    Commit 236208a5ff2d ("transport: use a bitmask for the transport")
    has an incorrect C statement in place of a return.
    The code is working thanks to the previous condition never true.
    
    The issue has been detected by clang scan-build in OpenOCD ACI
    since the missing return can make the following statement
    dereferencing a NULL pointer.
    
    Fix it!
    
    Change-Id: I3bbe04d99ad9b1288f55ba3c45e2e487aef9ae40
    Signed-off-by: Antonio Borneo <borneo.anto...@gmail.com>
    Fixes: 236208a5ff2d ("transport: use a bitmask for the transport")

diff --git a/src/transport/transport.c b/src/transport/transport.c
index ab5be490fb..5323a7ca0a 100644
--- a/src/transport/transport.c
+++ b/src/transport/transport.c
@@ -258,7 +258,7 @@ struct transport *get_current_transport(void)
 const char *get_current_transport_name(void)
 {
        if (!session || !is_transport_id_valid(session->id))
-               NULL;
+               return NULL;
 
        return transport_full_name(session->id);
 }

-- 

Reply via email to