Skip to content

Commit

Permalink
jtag/drivers/xds110: Fix compiler warning.
Browse files Browse the repository at this point in the history
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 <[email protected]>
Change-Id: Ibada85dcccfca6f1269c584cdbc4f2e3b93bb8f3
Reviewed-on: https://review.openocd.org/c/openocd/+/7813
Tested-by: jenkins
Reviewed-by: Tomas Vanek <[email protected]>
Reviewed-by: Antonio Borneo <[email protected]>
Reviewed-by: Jan Matyas <[email protected]>
  • Loading branch information
timsifive authored and tom-van committed Jul 24, 2023
1 parent 218f6c0 commit 7023deb
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/jtag/drivers/xds110.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}

/***************************************************************************
Expand Down

0 comments on commit 7023deb

Please sign in to comment.