diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2021-09-04 23:01:09 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2021-09-18 15:22:30 +0000 |
commit | 79800db98a985bcd601e8a892aed76d96548a51b (patch) | |
tree | 2250fd09d5be8834fe9c8e0ec513134758ccd971 /src/rtos | |
parent | ea562985b5eff536feea022b074122b21c3610ea (diff) | |
download | riscv-openocd-79800db98a985bcd601e8a892aed76d96548a51b.zip riscv-openocd-79800db98a985bcd601e8a892aed76d96548a51b.tar.gz riscv-openocd-79800db98a985bcd601e8a892aed76d96548a51b.tar.bz2 |
openocd: remove last NULL comparisons
The NULL pointers preceded by cast where not detected by the
scripting tools looking for NULL pointer comparison.
Remove them and, while there, further simplify the code and apply
the other coding style rules.
Change-Id: Ia7406122e07ef56ef311579ab0ee7ddb22c8e4b5
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: https://review.openocd.org/c/openocd/+/6539
Tested-by: jenkins
Reviewed-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
Diffstat (limited to 'src/rtos')
-rw-r--r-- | src/rtos/linux.c | 13 | ||||
-rw-r--r-- | src/rtos/rtos.c | 4 |
2 files changed, 8 insertions, 9 deletions
diff --git a/src/rtos/linux.c b/src/rtos/linux.c index 11a55c4..84b4c65 100644 --- a/src/rtos/linux.c +++ b/src/rtos/linux.c @@ -195,13 +195,12 @@ static int linux_os_thread_reg_list(struct rtos *rtos, found = 0; do { if (head->target->coreid == next->core_id) { - target = head->target; found = 1; - } else - head = head->next; - - } while ((head != (struct target_list *)NULL) && (found == 0)); + break; + } + head = head->next; + } while (head); if (found == 0) { LOG_ERROR @@ -414,7 +413,7 @@ static int get_current(struct target *target, int create) ctt = ctt->next; } - while (head != (struct target_list *)NULL) { + while (head) { struct reg **reg_list; int reg_list_size; int retval; @@ -1397,7 +1396,7 @@ static int linux_os_smp_init(struct target *target) struct current_thread *ct; head = target->head; - while (head != (struct target_list *)NULL) { + while (head) { if (head->target->rtos != rtos) { struct linux_os *smp_os_linux = (struct linux_os *)head->target->rtos->rtos_specific_params; diff --git a/src/rtos/rtos.c b/src/rtos/rtos.c index 0e747e3..eaad5e5 100644 --- a/src/rtos/rtos.c +++ b/src/rtos/rtos.c @@ -234,7 +234,7 @@ int rtos_qsymbol(struct connection *connection, char const *packet, int packet_s uint64_t addr = 0; size_t reply_len; char reply[GDB_BUFFER_SIZE + 1], cur_sym[GDB_BUFFER_SIZE / 2 + 1] = ""; /* Extra byte for null-termination */ - struct symbol_table_elem *next_sym = NULL; + struct symbol_table_elem *next_sym; struct target *target = get_target_from_connection(connection); struct rtos *os = target->rtos; @@ -272,7 +272,7 @@ int rtos_qsymbol(struct connection *connection, char const *packet, int packet_s next_sym = next_symbol(os, cur_sym, addr); /* Should never happen unless the debugger misbehaves */ - if (next_sym == NULL) { + if (!next_sym) { LOG_WARNING("RTOS: Debugger sent us qSymbol with '%s' that we did not ask for", cur_sym); goto done; } |