From c5806c0ae18450ed3f9d4fccc477bf571d0408bd Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sat, 28 Jun 2025 01:09:22 +0200 Subject: [PATCH] rtos: linux: drop useless code Since the initial code merged in 2012, the last case of the switch has a useless test on 'retval' that is not assigned in the case. Since 'retval' is initialized to ERROR_OK, the condition is always false. Drop the check on 'retval'. While there, drop the useless parenthesis around the 'case' and add the 'break' statement. Change-Id: I3f673b5e10f6b28a4a74881b8a06a71b58afb422 Signed-off-by: Antonio Borneo Reviewed-on: https://review.openocd.org/c/openocd/+/9036 Tested-by: jenkins --- src/rtos/linux.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/rtos/linux.c b/src/rtos/linux.c index 4ca02605e..7ee97668e 100644 --- a/src/rtos/linux.c +++ b/src/rtos/linux.c @@ -1332,7 +1332,7 @@ static int linux_thread_packet(struct connection *connection, char const *packet retval = GDB_THREAD_PACKET_NOT_CONSUMED; break; case 'c': - case 's': { + case 's': if (linux_os->threads_lookup == 1) { ct = linux_os->current_threads; @@ -1357,11 +1357,7 @@ static int linux_thread_packet(struct connection *connection, char const *packet LOG_INFO("threads_needs_update = 1"); linux_os->threads_needs_update = 1; } - } - - /* if a packet handler returned an error, exit input loop */ - if (retval != ERROR_OK) - return retval; + break; } return retval;