This is an automated email from Gerrit.

"Mark O'Donovan <[email protected]>" just uploaded a new patch set to Gerrit, 
which you can find at https://review.openocd.org/c/openocd/+/9500

-- gerrit

commit d8250e031778c6e3a990a97d813e53deea2b9c52
Author: Mark O'Donovan <[email protected]>
Date:   Tue Feb 24 20:41:43 2026 +0000

    pld/gowin: move pointer deref after NULL check
    
    Move pointer deref after NULL check.
    Found by cppcheck.
    
    Change-Id: Ic1b197fa43fa800cfec631614574dda46b137597
    Signed-off-by: Mark O'Donovan <[email protected]>

diff --git a/src/pld/gowin.c b/src/pld/gowin.c
index bbc2fe15f6..939e610600 100644
--- a/src/pld/gowin.c
+++ b/src/pld/gowin.c
@@ -172,11 +172,11 @@ static int gowin_read_fs_file(struct gowin_bit_file 
*bit_file, const char *filen
 
 static int gowin_read_file(struct gowin_bit_file *bit_file, const char 
*filename, bool *is_fs)
 {
-       memset(bit_file, 0, sizeof(struct gowin_bit_file));
-
        if (!filename || !bit_file)
                return ERROR_COMMAND_SYNTAX_ERROR;
 
+       memset(bit_file, 0, sizeof(struct gowin_bit_file));
+
        const char *file_suffix_pos = strrchr(filename, '.');
        if (!file_suffix_pos) {
                LOG_ERROR("Unable to detect filename suffix");

-- 

Reply via email to