mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-02 10:04:33 +00:00
usbutils - avoid free cgusb twice
This commit is contained in:
parent
983fe2b0c0
commit
1c69417def
@ -845,12 +845,16 @@ static struct cg_usb_device *free_cgusb(struct cg_usb_device *cgusb)
|
|||||||
|
|
||||||
void usb_uninit(struct cgpu_info *cgpu)
|
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_release_interface(cgpu->usbdev->handle, cgpu->usbdev->found->interface);
|
||||||
libusb_close(cgpu->usbdev->handle);
|
libusb_close(cgpu->usbdev->handle);
|
||||||
cgpu->usbdev = free_cgusb(cgpu->usbdev);
|
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 cg_usb_device *cgusb = cgpu->usbdev;
|
||||||
struct cgpu_info *lookcgpu;
|
struct cgpu_info *lookcgpu;
|
||||||
|
@ -129,7 +129,6 @@ struct device_drv;
|
|||||||
struct cgpu_info;
|
struct cgpu_info;
|
||||||
|
|
||||||
void usb_uninit(struct cgpu_info *cgpu);
|
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);
|
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 *));
|
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);
|
struct api_data *api_usb_stats(int *count);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user