Browse Source

Check for zero timeout in usb read.

nfactor-troky
Con Kolivas 12 years ago
parent
commit
2887147444
  1. 4
      usbutils.c

4
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 * if we don't sleep here, but do it only if we're not
* receiving any data. */ * receiving any data. */
timeout = initial_timeout - (done * 1000); timeout = initial_timeout - (done * 1000);
if (!timeout)
break;
if (!got && sleep_time) { if (!got && sleep_time) {
if (timeout <= sleep_time) if (timeout <= sleep_time)
sleep_time = timeout - 1; 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; break;
timeout = initial_timeout - (done * 1000); timeout = initial_timeout - (done * 1000);
if (!timeout)
break;
if (!got && sleep_time) { if (!got && sleep_time) {
if (timeout <= sleep_time) if (timeout <= sleep_time)
sleep_time = timeout - 1; sleep_time = timeout - 1;

Loading…
Cancel
Save