uru4000: avoid cancelling a completed transfer

This commit is contained in:
Daniel Drake 2008-04-12 16:58:49 +01:00
parent 870ddfb905
commit ebcabc1ade

View file

@ -467,9 +467,13 @@ static void image_cb(struct libusb_transfer *transfer)
struct fp_img *img;
int r = 0;
/* remove the global reference early: otherwise we may report results,
* leading to immediate deactivation of driver, which will potentially
* try to cancel an already-completed transfer */
urudev->img_transfer = NULL;
if (transfer->status == LIBUSB_TRANSFER_CANCELLED) {
fp_dbg("cancelled");
urudev->img_transfer = NULL;
g_free(transfer->buffer);
libusb_free_transfer(transfer);
return;