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/jtag/drivers/ftdi.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/jtag/drivers/ftdi.c')
-rw-r--r-- | src/jtag/drivers/ftdi.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/jtag/drivers/ftdi.c b/src/jtag/drivers/ftdi.c index f17cd9f..82298c2 100644 --- a/src/jtag/drivers/ftdi.c +++ b/src/jtag/drivers/ftdi.c @@ -150,11 +150,11 @@ static struct signal *create_signal(const char *name) psig = &(*psig)->next; *psig = calloc(1, sizeof(**psig)); - if (*psig == NULL) + if (!*psig) return NULL; (*psig)->name = strdup(name); - if ((*psig)->name == NULL) { + if (!(*psig)->name) { free(*psig); *psig = NULL; } @@ -1068,7 +1068,7 @@ static int ftdi_swd_init(void) swd_cmd_queue_alloced = 10; swd_cmd_queue = malloc(swd_cmd_queue_alloced * sizeof(*swd_cmd_queue)); - return swd_cmd_queue != NULL ? ERROR_OK : ERROR_FAIL; + return swd_cmd_queue ? ERROR_OK : ERROR_FAIL; } static void ftdi_swd_swdio_en(bool enable) @@ -1143,7 +1143,7 @@ static int ftdi_swd_run_queue(void) goto skip; } - if (swd_cmd_queue[i].dst != NULL) + if (swd_cmd_queue[i].dst) *swd_cmd_queue[i].dst = data; } } |