X-Git-Url: https://review.openocd.org/gitweb?a=blobdiff_plain;f=src%2Fjtag%2Fdrivers%2Fmpsse.c;h=9a334fc664e350e61005892d6685da57358353fa;hb=f75345b9150ad4b7079dd924540a871c5a4e71c1;hp=59927a0fe76f9085e41057fb0db8d16b2425b8cf;hpb=c979a08144ddea266fbf626182b5a06ad90e9ea8;p=openocd.git diff --git a/src/jtag/drivers/mpsse.c b/src/jtag/drivers/mpsse.c index 59927a0fe7..9a334fc664 100644 --- a/src/jtag/drivers/mpsse.c +++ b/src/jtag/drivers/mpsse.c @@ -24,7 +24,7 @@ #include "mpsse.h" #include "helper/log.h" -#include +#include /* Compatibility define for older libusb-1.0 */ #ifndef LIBUSB_CALL @@ -602,7 +602,7 @@ void mpsse_read_data_bits_low_byte(struct mpsse_ctx *ctx, uint8_t *data) return; } - if (buffer_write_space(ctx) < 1) + if (buffer_write_space(ctx) < 1 || buffer_read_space(ctx) < 1) ctx->retval = mpsse_flush(ctx); buffer_write_byte(ctx, 0x81); @@ -618,7 +618,7 @@ void mpsse_read_data_bits_high_byte(struct mpsse_ctx *ctx, uint8_t *data) return; } - if (buffer_write_space(ctx) < 1) + if (buffer_write_space(ctx) < 1 || buffer_read_space(ctx) < 1) ctx->retval = mpsse_flush(ctx); buffer_write_byte(ctx, 0x83); @@ -724,7 +724,7 @@ struct transfer_result { static LIBUSB_CALL void read_cb(struct libusb_transfer *transfer) { - struct transfer_result *res = (struct transfer_result *)transfer->user_data; + struct transfer_result *res = transfer->user_data; struct mpsse_ctx *ctx = res->ctx; unsigned packet_size = ctx->max_packet_size; @@ -762,7 +762,7 @@ static LIBUSB_CALL void read_cb(struct libusb_transfer *transfer) static LIBUSB_CALL void write_cb(struct libusb_transfer *transfer) { - struct transfer_result *res = (struct transfer_result *)transfer->user_data; + struct transfer_result *res = transfer->user_data; struct mpsse_ctx *ctx = res->ctx; res->transferred += transfer->actual_length;