Commit 043e9d9bab1b0b8d8c74202a8bc8b09f4f793081

Con Kolivas 2013-11-05T16:20:19

Make sure cgpu exists in the restart threads loop in cases of hotplug etc.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/cgminer.c b/cgminer.c
index 42ee76d..09fd008 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -4007,6 +4007,8 @@ static void restart_threads(void)
 	rd_lock(&mining_thr_lock);
 	for (i = 0; i < mining_threads; i++) {
 		cgpu = mining_thr[i]->cgpu;
+		if (unlikely(!cgpu))
+			continue;
 		mining_thr[i]->work_restart = true;
 		flush_queue(cgpu);
 		cgpu->drv->flush_work(cgpu);