From: Lars-Peter Clausen Date: Thu, 5 Jul 2012 19:38:36 +0000 (+0200) Subject: sr: fx2lafw: Free transfers in reverse order X-Git-Tag: dsupstream~873 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e7d087bf0e35ff97abae8bdd0c50e400c87b4b4d;p=libsigrok.git 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 Signed-off-by: Lars-Peter Clausen --- diff --git a/hardware/fx2lafw/fx2lafw.c b/hardware/fx2lafw/fx2lafw.c index be84761a..334a1109 100644 --- a/hardware/fx2lafw/fx2lafw.c +++ b/hardware/fx2lafw/fx2lafw.c @@ -662,11 +662,11 @@ static int receive_data(int fd, int revents, void *cb_data) static void abort_acquisition(struct context *ctx) { - unsigned int i; + int i; 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]) libusb_cancel_transfer(ctx->transfers[i]); }