diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2021-07-03 21:29:32 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2021-07-24 10:38:00 +0100 |
commit | 391782318723915bd259eadf9469251c13c8fa9c (patch) | |
tree | df5fe28d94e46fd98bf54f47152034db5696f5da /src/target/esirisc.c | |
parent | 08ee7bb982b16742f52cfdc6c649d82ffa2eb177 (diff) | |
download | riscv-openocd-391782318723915bd259eadf9469251c13c8fa9c.zip riscv-openocd-391782318723915bd259eadf9469251c13c8fa9c.tar.gz riscv-openocd-391782318723915bd259eadf9469251c13c8fa9c.tar.bz2 |
openocd: remove NULL comparisons with checkpatch [1/2]
Patch generated automatically through the new checkpatch with
flags "--types COMPARISON_TO_NULL --fix-inplace".
This only fixes the comparisons
if (symbol == NULL)
if (symbol != NULL)
The case of NULL on the left side of the comparison is not tested.
Some automatic fix is incorrect and has been massaged by hands:
- if (*psig == NULL)
+ if (*!psig)
changed as
+ if (!*psig)
Change-Id: If4a1e2b4e547e223532e8e3d9da89bf9cb382ce6
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-on: http://openocd.zylin.com/6351
Tested-by: jenkins
Diffstat (limited to 'src/target/esirisc.c')
-rw-r--r-- | src/target/esirisc.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/target/esirisc.c b/src/target/esirisc.c index d17e1dd..e49f5f6 100644 --- a/src/target/esirisc.c +++ b/src/target/esirisc.c @@ -472,7 +472,7 @@ static int esirisc_next_breakpoint(struct target *target) LOG_DEBUG("-"); for (int bp_index = 0; breakpoints_p < breakpoints_e; ++breakpoints_p, ++bp_index) - if (*breakpoints_p == NULL) + if (!*breakpoints_p) return bp_index; return -1; @@ -608,7 +608,7 @@ static int esirisc_next_watchpoint(struct target *target) LOG_DEBUG("-"); for (int wp_index = 0; watchpoints_p < watchpoints_e; ++watchpoints_p, ++wp_index) - if (*watchpoints_p == NULL) + if (!*watchpoints_p) return wp_index; return -1; @@ -1267,7 +1267,7 @@ static const char *esirisc_get_gdb_arch(struct target *target) * requires additional configuration to properly interact with these * targets in GDB (also see: `esirisc cache_arch`). */ - if (esirisc->gdb_arch == NULL && target_was_examined(target)) + if (!esirisc->gdb_arch && target_was_examined(target)) esirisc->gdb_arch = alloc_printf("esirisc:%d_bit_%d_reg_%s", esirisc->num_bits, esirisc->num_regs, esirisc_cache_arch_name(esirisc)); @@ -1284,7 +1284,7 @@ static int esirisc_get_gdb_reg_list(struct target *target, struct reg **reg_list *reg_list_size = ESIRISC_NUM_REGS; *reg_list = calloc(*reg_list_size, sizeof(struct reg *)); - if (*reg_list == NULL) + if (!*reg_list) return ERROR_FAIL; if (reg_class == REG_CLASS_ALL) |