Browse Source

Bugfix: hashbuster: Close device after failures

Luke Dashjr 12 years ago
parent
commit
97e6025ca3
1 changed files with 6 additions and 0 deletions
  1. 6 0
      driver-hashbuster.c

+ 6 - 0
driver-hashbuster.c

@@ -163,8 +163,11 @@ bool hashbuster_foundlowl(struct lowlevel_device_info * const info, __maybe_unus
 		       __func__, path);
 	
 	if ((!hashbuster_io(h, buf, buf)) || buf[1] != 0x07)
+	{
+		hid_close(h);
 		applogr(false, LOG_DEBUG, "%s: Identify sequence didn't match on %s",
 		        __func__, path);
+	}
 	
 	struct spi_port spi = {
 		.txrx = hashbuster_spi_txrx,
@@ -225,7 +228,10 @@ bool hashbuster_init(struct thr_info * const thr)
 	lowlevel_devinfo_free(cgpu->device_data);
 	
 	if (!h)
+	{
+		hid_close(h);
 		applogr(false, LOG_ERR, "%s: Failed to open hid device", cgpu->dev_repr);
+	}
 	
 	port = malloc(sizeof(*port));
 	if (!port)