diff options
author | Antonio Borneo <borneo.antonio@gmail.com> | 2023-05-06 10:16:08 +0200 |
---|---|---|
committer | Antonio Borneo <borneo.antonio@gmail.com> | 2023-05-06 13:30:33 +0000 |
commit | 92c1bee18c8268511de3478aabd226ce4f92322a (patch) | |
tree | 62e494416554b9243d137fe10dd7f243becdcf89 | |
parent | dd9137dc0e0c9a7dd3468ecb7adb0427b8f06715 (diff) | |
download | riscv-openocd-92c1bee18c8268511de3478aabd226ce4f92322a.zip riscv-openocd-92c1bee18c8268511de3478aabd226ce4f92322a.tar.gz riscv-openocd-92c1bee18c8268511de3478aabd226ce4f92322a.tar.bz2 |
jtag: xds110: fix check on malloc() returned pointer
Commit 07e1ebcc12cd ("jtag: drivers: with pointers, use NULL
instead of 0") incorrectly inverts the check, making the driver's
pathmove operation not functional and triggering two clang errors.
Fix the check on malloc() returned pointer.
Change-Id: If1f220aca67452adbcd3a1c9cf691fc984b16b27
Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Fixes: 07e1ebcc12cd ("jtag: drivers: with pointers, use NULL instead of 0")
Reviewed-on: https://review.openocd.org/c/openocd/+/7656
Tested-by: jenkins
-rw-r--r-- | src/jtag/drivers/xds110.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/jtag/drivers/xds110.c b/src/jtag/drivers/xds110.c index 3ea98ad..371dc88 100644 --- a/src/jtag/drivers/xds110.c +++ b/src/jtag/drivers/xds110.c @@ -1688,7 +1688,7 @@ static void xds110_execute_pathmove(struct jtag_command *cmd) return; path = malloc(num_states * sizeof(uint8_t)); - if (path) { + if (!path) { LOG_ERROR("XDS110: unable to allocate memory"); return; } |