Commit 176747fbc96e6694f031fa863a61a555c18ec408

Con Kolivas 2013-11-07T23:22:11

Check for fatal read errors and break out of the read loop in avalon.

diff --git a/driver-avalon.c b/driver-avalon.c
index c9a196f..53704e9 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -295,6 +295,8 @@ static int avalon_read(struct cgpu_info *avalon, char *buf, size_t bufsize, int 
 	err = usb_read_once(avalon, buf, bufsize, &amount, ep);
 	applog(LOG_DEBUG, "%s%i: Get avalon read got err %d",
 	       avalon->drv->name, avalon->device_id, err);
+	if (unlikely(err && err != LIBUSB_ERROR_TIMEOUT))
+		amount = -1;
 	return amount;
 }
 
@@ -984,6 +986,9 @@ static void *avalon_get_results(void *userdata)
 
 		ret = avalon_read(avalon, buf, rsize, C_AVALON_READ);
 
+		if (unlikely(ret < 0))
+			break;
+
 		if (ret < 1)
 			continue;