1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-22 20:44:19 +00:00

usbutils - avoid free cgusb twice

This commit is contained in:
Kano 2013-02-03 14:02:31 +11:00
parent 983fe2b0c0
commit 1c69417def
2 changed files with 5 additions and 2 deletions

View File

@ -845,12 +845,16 @@ static struct cg_usb_device *free_cgusb(struct cg_usb_device *cgusb)
void usb_uninit(struct cgpu_info *cgpu)
{
// May have happened already during a failed initialisation
// if release_cgpu() was called due to a USB NODEV(err)
if (!cgpu->usbdev)
return;
libusb_release_interface(cgpu->usbdev->handle, cgpu->usbdev->found->interface);
libusb_close(cgpu->usbdev->handle);
cgpu->usbdev = free_cgusb(cgpu->usbdev);
}
void release_cgpu(struct cgpu_info *cgpu)
static void release_cgpu(struct cgpu_info *cgpu)
{
struct cg_usb_device *cgusb = cgpu->usbdev;
struct cgpu_info *lookcgpu;

View File

@ -129,7 +129,6 @@ struct device_drv;
struct cgpu_info;
void usb_uninit(struct cgpu_info *cgpu);
void release_cgpu(struct cgpu_info *cgpu);
bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find_devices *found);
void usb_detect(struct device_drv *drv, bool (*device_detect)(struct libusb_device *, struct usb_find_devices *));
struct api_data *api_usb_stats(int *count);