Increment hardware error count from the one site.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
diff --git a/cgminer.c b/cgminer.c
index 664ca99..cbbb510 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -5515,6 +5515,16 @@ void submit_work_async(struct work *work_in, struct timeval *tv_work_found)
quit(1, "Failed to create submit_work_thread");
}
+void inc_hw_errors(struct thr_info *thr)
+{
+ mutex_lock(&stats_lock);
+ hw_errors++;
+ thr->cgpu->hw_errors++;
+ mutex_unlock(&stats_lock);
+
+ thr->cgpu->drv->hw_error(thr);
+}
+
static bool hashtest(struct thr_info *thr, struct work *work)
{
uint32_t *data32 = (uint32_t *)(work->data);
@@ -5534,13 +5544,7 @@ static bool hashtest(struct thr_info *thr, struct work *work)
applog(LOG_WARNING, "%s%d: invalid nonce - HW error",
thr->cgpu->drv->name, thr->cgpu->device_id);
- mutex_lock(&stats_lock);
- hw_errors++;
- thr->cgpu->hw_errors++;
- mutex_unlock(&stats_lock);
-
- thr->cgpu->drv->hw_error(thr);
-
+ inc_hw_errors(thr);
goto out;
}
diff --git a/findnonce.c b/findnonce.c
index e99b7e1..65055d9 100644
--- a/findnonce.c
+++ b/findnonce.c
@@ -186,10 +186,8 @@ static void send_scrypt_nonce(struct pc_data *pcd, uint32_t nonce)
if (scrypt_test(work->data, work->target, nonce))
submit_nonce(thr, work, nonce);
- else {
- applog(LOG_INFO, "Scrypt error, review settings");
- thr->cgpu->hw_errors++;
- }
+ else
+ inc_hw_errors(thr);
}
static void *postcalc_hash(void *userdata)
diff --git a/miner.h b/miner.h
index 3d275da..c992cce 100644
--- a/miner.h
+++ b/miner.h
@@ -1201,6 +1201,7 @@ struct modminer_fpga_state {
#endif
extern void get_datestamp(char *, struct timeval *);
+extern void inc_hw_errors(struct thr_info *thr);
extern void submit_nonce(struct thr_info *thr, struct work *work, uint32_t nonce);
extern struct work *get_queued(struct cgpu_info *cgpu);
extern struct work *__find_work_bymidstate(struct work *que, char *midstate, size_t midstatelen, char *data, int offset, size_t datalen);