Browse Source

Check for zero timeout in usb read.

Con Kolivas 12 years ago
parent
commit
2887147444
1 changed files with 4 additions and 0 deletions
  1. 4 0
      usbutils.c

+ 4 - 0
usbutils.c

@@ -2114,6 +2114,8 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
 			 * if we don't sleep here, but do it only if we're not
 			 * receiving any data. */
 			timeout = initial_timeout - (done * 1000);
+			if (!timeout)
+				break;
 			if (!got && sleep_time) {
 				if (timeout <= sleep_time)
 					sleep_time = timeout - 1;
@@ -2206,6 +2208,8 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
 			break;
 
 		timeout = initial_timeout - (done * 1000);
+		if (!timeout)
+			break;
 		if (!got && sleep_time) {
 			if (timeout <= sleep_time)
 				sleep_time = timeout - 1;