Commit fdfb77e7c26c792698bcc4086f996afba35fcea6

Con Kolivas 2013-04-16T22:41:45

Unconditionally test for many wrong results on avalon and reset to avoid passing a corrupt avalon result to temperature code.

diff --git a/driver-avalon.c b/driver-avalon.c
index 4ca3952..7e14a21 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -929,22 +929,21 @@ static int64_t avalon_scanhash(struct thr_info *thr)
 			       elapsed.tv_sec, elapsed.tv_usec);
 		}
 	}
-	if (hash_count) {
-		if (avalon->results < AVALON_ARRAY_SIZE)
-			avalon->results++;
-	} else if (unlikely((result_wrong >= avalon_get_work_count ) ||
-		   (ret != AVA_GETS_RESTART && --avalon->results < 0))) {
-			/* Look for all invalid results, or consecutive failure
-			 * to generate any results suggesting the FPGA
-			 * controller has screwed up. */
-			do_avalon_close(thr);
-			applog(LOG_ERR,
-			       "AVA%i: FPGA controller messed up, %d wrong results",
-			       avalon->device_id, result_wrong);
-			dev_error(avalon, REASON_DEV_COMMS_ERROR);
-			sleep(1);
-			avalon_init(avalon);
-			return 0;
+	if (hash_count && avalon->results < AVALON_ARRAY_SIZE)
+		avalon->results++;
+	if (unlikely((result_wrong >= avalon_get_work_count) ||
+	    (!hash_count && ret != AVA_GETS_RESTART && --avalon->results < 0))) {
+		/* Look for all invalid results, or consecutive failure
+		 * to generate any results suggesting the FPGA
+		 * controller has screwed up. */
+		do_avalon_close(thr);
+		applog(LOG_ERR,
+			"AVA%i: FPGA controller messed up, %d wrong results",
+			avalon->device_id, result_wrong);
+		dev_error(avalon, REASON_DEV_COMMS_ERROR);
+		sleep(1);
+		avalon_init(avalon);
+		return 0;
 	}
 
 	avalon_rotate_array(avalon);