klondike - dont try to flush if not initialised
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
diff --git a/driver-klondike.c b/driver-klondike.c
index 2446202..3a740ec 100644
--- a/driver-klondike.c
+++ b/driver-klondike.c
@@ -1129,26 +1129,28 @@ static void klondike_flush_work(struct cgpu_info *klncgpu)
KLINE kline;
int slaves, dev;
- wr_lock(&(klninfo->stat_lock));
- klninfo->block_seq++;
- slaves = klninfo->status[0].kline.ws.slavecount;
- wr_unlock(&(klninfo->stat_lock));
+ if (klninfo->initialised) {
+ wr_lock(&(klninfo->stat_lock));
+ klninfo->block_seq++;
+ slaves = klninfo->status[0].kline.ws.slavecount;
+ wr_unlock(&(klninfo->stat_lock));
- applog(LOG_DEBUG, "%s%i: flushing work",
- klncgpu->drv->name, klncgpu->device_id);
- zero_kline(&kline);
- kline.hd.cmd = KLN_CMD_ABORT;
- for (dev = 0; dev <= slaves; dev++) {
- kline.hd.dev = dev;
- kitem = SendCmdGetReply(klncgpu, &kline, KSENDHD(0));
- if (kitem != NULL) {
- wr_lock(&(klninfo->stat_lock));
- memcpy((void *)&(klninfo->status[dev]),
- kitem,
- sizeof(klninfo->status[dev]));
- klninfo->jobque[dev].flushed = true;
- wr_unlock(&(klninfo->stat_lock));
- kitem = release_kitem(klncgpu, kitem);
+ applog(LOG_DEBUG, "%s%i: flushing work",
+ klncgpu->drv->name, klncgpu->device_id);
+ zero_kline(&kline);
+ kline.hd.cmd = KLN_CMD_ABORT;
+ for (dev = 0; dev <= slaves; dev++) {
+ kline.hd.dev = dev;
+ kitem = SendCmdGetReply(klncgpu, &kline, KSENDHD(0));
+ if (kitem != NULL) {
+ wr_lock(&(klninfo->stat_lock));
+ memcpy((void *)&(klninfo->status[dev]),
+ kitem,
+ sizeof(klninfo->status[dev]));
+ klninfo->jobque[dev].flushed = true;
+ wr_unlock(&(klninfo->stat_lock));
+ kitem = release_kitem(klncgpu, kitem);
+ }
}
}
}