Commit f0003055a4fac9cb9ea27ab7eb8a1ee8e30c10d3

Kano 2012-12-19T14:30:48

MMQ ensure delta clock can never exceed limits

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/driver-modminer.c b/driver-modminer.c
index 07f4400..4612a1c 100644
--- a/driver-modminer.c
+++ b/driver-modminer.c
@@ -623,10 +623,10 @@ static const char *modminer_delta_clock(struct thr_info *thr, int delta, bool te
 	state->hw_errors = 0;
 
 	// FYI clock drop has little effect on temp
-	if (delta < 0 && modminer->clock <= MODMINER_MIN_CLOCK)
+	if (delta < 0 && (modminer->clock + delta) < MODMINER_MIN_CLOCK)
 		return clocktoolow;
 
-	if (delta > 0 && modminer->clock >= MODMINER_MAX_CLOCK)
+	if (delta > 0 && (modminer->clock + delta) > MODMINER_MAX_CLOCK)
 		return clocktoohi;
 
 	if (delta < 0) {