Commit 73f6a570f31a3a99219dc5e977ee2e53166494de

Con Kolivas 2013-11-03T09:25:28

Look for timeout overruns in usb read/write.

diff --git a/usbutils.c b/usbutils.c
index f193cfb..2db5b5a 100644
--- a/usbutils.c
+++ b/usbutils.c
@@ -2586,7 +2586,7 @@ int _usb_read(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_t
 			if (unlikely(done >= max))
 				break;
 			timeout = initial_timeout - (done * 1000);
-			if (!timeout)
+			if (timeout <= 0)
 				break;
 		}
 
@@ -2674,7 +2674,7 @@ int _usb_read(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_t
 		if (unlikely(done >= max))
 			break;
 		timeout = initial_timeout - (done * 1000);
-		if (!timeout)
+		if (timeout <= 0)
 			break;
 	}
 
@@ -2795,7 +2795,7 @@ int _usb_write(struct cgpu_info *cgpu, int intinfo, int epinfo, char *buf, size_
 		if (unlikely(done >= max))
 			break;
 		timeout = initial_timeout - (done * 1000);
-		if (!timeout)
+		if (timeout <= 0)
 			break;
 	}