]> sigrok.org Git - libsigrok.git/commitdiff
sr: fx2lafw: Free transfers in reverse order
authorLars-Peter Clausen <redacted>
Thu, 5 Jul 2012 19:38:36 +0000 (21:38 +0200)
committerUwe Hermann <redacted>
Sun, 8 Jul 2012 19:39:30 +0000 (21:39 +0200)
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 <redacted>
Signed-off-by: Lars-Peter Clausen <redacted>
hardware/fx2lafw/fx2lafw.c

index be84761a7db48fe10b952f7d3e2b1598ffd76a55..334a11094d8239d25db86050e4241d35e5b46d64 100644 (file)
@@ -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]);
        }