Browse Source

usbutils - avoid free cgusb twice

nfactor-troky
Kano 12 years ago
parent
commit
1c69417def
  1. 6
      usbutils.c
  2. 1
      usbutils.h

6
usbutils.c

@ -845,12 +845,16 @@ static struct cg_usb_device *free_cgusb(struct cg_usb_device *cgusb) @@ -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;

1
usbutils.h

@ -129,7 +129,6 @@ struct device_drv; @@ -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);

Loading…
Cancel
Save