From 92c1bee18c8268511de3478aabd226ce4f92322a Mon Sep 17 00:00:00 2001 From: Antonio Borneo Date: Sat, 6 May 2023 10:16:08 +0200 Subject: [PATCH] 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 Fixes: 07e1ebcc12cd ("jtag: drivers: with pointers, use NULL instead of 0") Reviewed-on: https://review.openocd.org/c/openocd/+/7656 Tested-by: jenkins --- src/jtag/drivers/xds110.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jtag/drivers/xds110.c b/src/jtag/drivers/xds110.c index 3ea98ad6b..371dc8803 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; }