Do avalon_reset after info structure is set up.
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
diff --git a/driver-avalon.c b/driver-avalon.c
index 6accf45..f0c5774 100644
--- a/driver-avalon.c
+++ b/driver-avalon.c
@@ -615,13 +615,6 @@ static bool avalon_detect_one(const char *devpath)
avalon->threads = AVALON_MINER_THREADS;
add_cgpu(avalon);
- ret = avalon_reset(avalon, fd);
- if (ret) {
- ; /* FIXME: I think IT IS avalon and wait on reset;
- * avalon_close(fd);
- * return false; */
- }
-
avalon_infos = realloc(avalon_infos,
sizeof(struct avalon_info *) *
(total_devices + 1));
@@ -636,8 +629,6 @@ static bool avalon_detect_one(const char *devpath)
avalon->device_data = avalon_infos[avalon->device_id];
info = avalon->device_data;
- memset(info, 0, sizeof(struct avalon_info));
-
info->baud = baud;
info->miner_count = miner_count;
info->asic_count = asic_count;
@@ -657,6 +648,13 @@ static bool avalon_detect_one(const char *devpath)
avalon->device_fd = -1;
+ ret = avalon_reset(avalon, fd);
+ if (ret) {
+ ; /* FIXME: I think IT IS avalon and wait on reset;
+ * avalon_close(fd);
+ * return false; */
+ }
+
avalon_close(fd);
return true;
}