Browse Source

Merge commit '3369f44' into bfgminer

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

+ 6 - 0
driver-hashbusterusb.c

@@ -167,11 +167,17 @@ bool hashbusterusb_lowl_probe(const struct lowlevel_device_info * const info)
 		applogr(false, LOG_ERR, "%s: Failed to open %s: %s",
 		applogr(false, LOG_ERR, "%s: Failed to open %s: %s",
 		        __func__, info->devid, bfg_strerror(j, BST_LIBUSB));
 		        __func__, info->devid, bfg_strerror(j, BST_LIBUSB));
 	if ( (j = libusb_set_configuration(h, 1)) )
 	if ( (j = libusb_set_configuration(h, 1)) )
+	{
+		libusb_close(h);
 		applogr(false, LOG_ERR, "%s: Failed to set configuration 1 on %s: %s",
 		applogr(false, LOG_ERR, "%s: Failed to set configuration 1 on %s: %s",
 		        __func__, info->devid, bfg_strerror(j, BST_LIBUSB));
 		        __func__, info->devid, bfg_strerror(j, BST_LIBUSB));
+	}
 	if ( (j = libusb_claim_interface(h, 0)) )
 	if ( (j = libusb_claim_interface(h, 0)) )
+	{
+		libusb_close(h);
 		applogr(false, LOG_ERR, "%s: Failed to claim interface 0 on %s: %s",
 		applogr(false, LOG_ERR, "%s: Failed to claim interface 0 on %s: %s",
 		        __func__, info->devid, bfg_strerror(j, BST_LIBUSB));
 		        __func__, info->devid, bfg_strerror(j, BST_LIBUSB));
+	}
 	struct lowl_usb_endpoint * const ep = usb_open_ep_pair(h, 0x81, 64, 0x01, 64);
 	struct lowl_usb_endpoint * const ep = usb_open_ep_pair(h, 0x81, 64, 0x01, 64);
 	usb_ep_set_timeouts_ms(ep, 100, 0);
 	usb_ep_set_timeouts_ms(ep, 100, 0);