From: Hans de Goede Date: Mon, 26 Mar 2012 20:33:39 +0000 (+0100) Subject: Linux: Fix cancel_transfer return value when cancelling a multi-urb transfer X-Git-Tag: upstream/1.0.21~720 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d041159a1720c14568154c07f94b01340b991417;p=platform%2Fupstream%2Flibusb.git Linux: Fix cancel_transfer return value when cancelling a multi-urb transfer * if we've successfully cancelled the last urb, and then another urb fails with errno == EINVAL, we shouldn't return LIBUSB_ERROR_NOT_FOUND --- diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c index ad3c37a..703d844 100644 --- a/libusb/os/linux_usbfs.c +++ b/libusb/os/linux_usbfs.c @@ -1483,7 +1483,8 @@ static int discard_urbs(struct usbi_transfer *itransfer, int first, int last_plu if (EINVAL == errno) { usbi_dbg("URB not found --> assuming ready to be reaped"); - ret = LIBUSB_ERROR_NOT_FOUND; + if (i == (last_plus_one - 1)) + ret = LIBUSB_ERROR_NOT_FOUND; } else if (ENODEV == errno) { usbi_dbg("Device not found for URB --> assuming ready to be reaped"); ret = LIBUSB_ERROR_NO_DEVICE;