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 <tim@sifive.com>
Change-Id: Ibada85dcccfca6f1269c584cdbc4f2e3b93bb8f3
Reviewed-on: https://review.openocd.org/c/openocd/+/7813
Tested-by: jenkins
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
Reviewed-by: Jan Matyas <jan.matyas@codasip.com>
This commit is contained in:
Tim Newsome 2023-07-13 09:38:44 -07:00 committed by Tomas Vanek
parent 218f6c0181
commit 7023deb06a
1 changed files with 1 additions and 10 deletions

View File

@ -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);
}
/***************************************************************************