Commit fa7f84e6d78ae294d05b15eef79b7ca7cbd5bfb1

Con Kolivas 2014-02-24T02:24:33

Clear all structures should we fail to hfa reset on adjusting clock on a hotplug.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff --git a/driver-hashfast.c b/driver-hashfast.c
index bf3051e..4a2be10 100644
--- a/driver-hashfast.c
+++ b/driver-hashfast.c
@@ -652,8 +652,13 @@ static bool hfa_detect_common(struct cgpu_info *hashfast)
 		if (info->hash_clock_rate != cinfo->hash_clock_rate) {
 			info->hash_clock_rate = cinfo->hash_clock_rate;
 			ret = hfa_reset(hashfast, hashfast->device_data);
-			if (!ret)
+			if (!ret) {
+				hfa_send_shutdown(hashfast);
+				hfa_clear_readbuf(hashfast);
+				free(info);
+				hashfast->device_data = NULL;
 				return false;
+			}
 		}
 	}