Commit 0e5c716cfcb0c0ae2d26145b7cd711ca6816749e

Denis Ahrens 2012-11-26T02:41:07

ztex: Correctly release mutex and reset FPGA if configuration fails

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/driver-ztex.c b/driver-ztex.c
index 5f7cdb3..4151069 100644
--- a/driver-ztex.c
+++ b/driver-ztex.c
@@ -362,8 +362,11 @@ static bool ztex_prepare(struct thr_info *thr)
 	get_datestamp(cgpu->init, &now);
 	
 	ztex_selectFpga(ztex);
-	if (libztex_configureFpga(ztex) != 0)
+	if (libztex_configureFpga(ztex) != 0) {
+		libztex_resetFpga(ztex);
+		ztex_releaseFpga(ztex);
 		return false;
+	}
 	ztex_releaseFpga(ztex);
 	ztex->freqM = ztex->freqMaxM+1;;
 	//ztex_updateFreq(ztex);