sr: fx2lafw: Free transfers in reverse order

Free the USB transfers in the reverse order of which they were submitted. This
will avoid that while transfer 0 is cancelledd transfer 1 is started by the
host controller, and so on.

Reported-by: Peter Stuge <peter@stuge.se>
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
Lars-Peter Clausen 2012-07-05 21:38:36 +02:00 committed by Uwe Hermann
parent 1a895c6185
commit e7d087bf0e
1 changed files with 2 additions and 2 deletions

View File

@ -662,11 +662,11 @@ static int receive_data(int fd, int revents, void *cb_data)
static void abort_acquisition(struct context *ctx) static void abort_acquisition(struct context *ctx)
{ {
unsigned int i; int i;
ctx->num_samples = -1; ctx->num_samples = -1;
for (i = 0; i < ctx->num_transfers; i++) { for (i = ctx->num_transfers - 1; i >= 0; i--) {
if (ctx->transfers[i]) if (ctx->transfers[i])
libusb_cancel_transfer(ctx->transfers[i]); libusb_cancel_transfer(ctx->transfers[i]);
} }