From 7023deb06a8cac77fe50d341c9e34b80d4fc68fd Mon Sep 17 00:00:00 2001 From: Tim Newsome Date: Thu, 13 Jul 2023 09:38:44 -0700 Subject: [PATCH] jtag/drivers/xds110: Fix compiler warning. Compiler would complain that `written` was used without being initialized. Simplify the code a little. The number of bytes written is already checked in usb_write(). Signed-off-by: Tim Newsome Change-Id: Ibada85dcccfca6f1269c584cdbc4f2e3b93bb8f3 Reviewed-on: https://review.openocd.org/c/openocd/+/7813 Tested-by: jenkins Reviewed-by: Tomas Vanek Reviewed-by: Antonio Borneo Reviewed-by: Jan Matyas --- src/jtag/drivers/xds110.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/jtag/drivers/xds110.c b/src/jtag/drivers/xds110.c index 371dc8803..717295c73 100644 --- a/src/jtag/drivers/xds110.c +++ b/src/jtag/drivers/xds110.c @@ -579,9 +579,6 @@ static bool usb_get_response(uint32_t *total_bytes_read, uint32_t timeout) static bool usb_send_command(uint16_t size) { - int written; - bool success = true; - /* Check the packet length */ if (size > USB_PAYLOAD_SIZE) return false; @@ -596,13 +593,7 @@ static bool usb_send_command(uint16_t size) size += 3; /* Send the data via the USB connection */ - success = usb_write(xds110.write_packet, (int)size, &written); - - /* Check if the correct number of bytes was written */ - if (written != (int)size) - success = false; - - return success; + return usb_write(xds110.write_packet, (int)size, NULL); } /***************************************************************************