rtos/hwthread: move pointer deref after NULL check

Move pointer deref after NULL check.
Found by cppcheck.

Change-Id: I41b20a0598da83b6d7e353042b6f69e7a58706fc
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed-on: https://review.openocd.org/c/openocd/+/9501
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Tested-by: jenkins
This commit is contained in:
Mark O'Donovan
2026-02-24 20:37:06 +00:00
committed by Antonio Borneo
parent bd17a59fd1
commit 49e75c74d5

View File

@@ -94,12 +94,13 @@ static int hwthread_update_threads(struct rtos *rtos)
struct target_list *head; struct target_list *head;
struct target *target; struct target *target;
int64_t current_thread = 0; int64_t current_thread = 0;
int64_t current_threadid = rtos->current_threadid; /* thread selected by GDB */ int64_t current_threadid;
enum target_debug_reason current_reason = DBG_REASON_UNDEFINED; enum target_debug_reason current_reason = DBG_REASON_UNDEFINED;
if (!rtos) if (!rtos)
return -1; return -1;
current_threadid = rtos->current_threadid; /* thread selected by GDB */
target = rtos->target; target = rtos->target;
/* wipe out previous thread details if any */ /* wipe out previous thread details if any */