Commit 8ec78c28e0447aff88b2345b4576c2ec8484fe5f

Con Kolivas 2013-06-07T00:38:48

Only libusb close if libusb release succeeds.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/usbutils.c b/usbutils.c
index 323bd7c..aad0a40 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -1328,8 +1328,8 @@ void usb_uninit(struct cgpu_info *cgpu)
 	//  if release_cgpu() was called due to a USB NODEV(err)
 	if (!cgpu->usbdev)
 		return;
-	libusb_release_interface(cgpu->usbdev->handle, cgpu->usbdev->found->interface);
-	libusb_close(cgpu->usbdev->handle);
+	if (!libusb_release_interface(cgpu->usbdev->handle, cgpu->usbdev->found->interface))
+		libusb_close(cgpu->usbdev->handle);
 	cgpu->usbdev = free_cgusb(cgpu->usbdev);
 }