mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 15:27:53 +00:00
Unlock usb dev lock in the same place in usbutils.
This commit is contained in:
parent
9604cbee98
commit
827a6ab7da
34
usbutils.c
34
usbutils.c
@ -1718,9 +1718,8 @@ static int _usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct u
|
|||||||
cgpu->drv->name = (char *)(found->name);
|
cgpu->drv->name = (char *)(found->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
DEVUNLOCK(cgpu, pstate);
|
bad = USB_INIT_OK;
|
||||||
|
goto out_unlock;
|
||||||
return USB_INIT_OK;
|
|
||||||
|
|
||||||
cldame:
|
cldame:
|
||||||
|
|
||||||
@ -1733,6 +1732,7 @@ dame:
|
|||||||
|
|
||||||
cgusb = free_cgusb(cgusb);
|
cgusb = free_cgusb(cgusb);
|
||||||
|
|
||||||
|
out_unlock:
|
||||||
DEVUNLOCK(cgpu, pstate);
|
DEVUNLOCK(cgpu, pstate);
|
||||||
|
|
||||||
return bad;
|
return bad;
|
||||||
@ -2190,9 +2190,8 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
|
|||||||
*processed = 0;
|
*processed = 0;
|
||||||
USB_REJECT(cgpu, MODE_BULK_READ);
|
USB_REJECT(cgpu, MODE_BULK_READ);
|
||||||
|
|
||||||
DEVUNLOCK(cgpu, pstate);
|
err = LIBUSB_ERROR_NO_DEVICE;
|
||||||
|
goto out_unlock;
|
||||||
return LIBUSB_ERROR_NO_DEVICE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
usbdev = cgpu->usbdev;
|
usbdev = cgpu->usbdev;
|
||||||
@ -2294,9 +2293,7 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
|
|||||||
if (NODEV(err))
|
if (NODEV(err))
|
||||||
release_cgpu(cgpu);
|
release_cgpu(cgpu);
|
||||||
|
|
||||||
DEVUNLOCK(cgpu, pstate);
|
goto out_unlock;
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usbdev->buffer && usbdev->bufamt) {
|
if (usbdev->buffer && usbdev->bufamt) {
|
||||||
@ -2411,6 +2408,7 @@ int _usb_read(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pro
|
|||||||
if (NODEV(err))
|
if (NODEV(err))
|
||||||
release_cgpu(cgpu);
|
release_cgpu(cgpu);
|
||||||
|
|
||||||
|
out_unlock:
|
||||||
DEVUNLOCK(cgpu, pstate);
|
DEVUNLOCK(cgpu, pstate);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
@ -2437,9 +2435,8 @@ int _usb_write(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pr
|
|||||||
if (cgpu->usbinfo.nodev) {
|
if (cgpu->usbinfo.nodev) {
|
||||||
USB_REJECT(cgpu, MODE_BULK_WRITE);
|
USB_REJECT(cgpu, MODE_BULK_WRITE);
|
||||||
|
|
||||||
DEVUNLOCK(cgpu, pstate);
|
err = LIBUSB_ERROR_NO_DEVICE;
|
||||||
|
goto out_unlock;
|
||||||
return LIBUSB_ERROR_NO_DEVICE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
usbdev = cgpu->usbdev;
|
usbdev = cgpu->usbdev;
|
||||||
@ -2491,6 +2488,7 @@ int _usb_write(struct cgpu_info *cgpu, int ep, char *buf, size_t bufsiz, int *pr
|
|||||||
if (NODEV(err))
|
if (NODEV(err))
|
||||||
release_cgpu(cgpu);
|
release_cgpu(cgpu);
|
||||||
|
|
||||||
|
out_unlock:
|
||||||
DEVUNLOCK(cgpu, pstate);
|
DEVUNLOCK(cgpu, pstate);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
@ -2512,9 +2510,8 @@ int _usb_transfer(struct cgpu_info *cgpu, uint8_t request_type, uint8_t bRequest
|
|||||||
if (cgpu->usbinfo.nodev) {
|
if (cgpu->usbinfo.nodev) {
|
||||||
USB_REJECT(cgpu, MODE_CTRL_WRITE);
|
USB_REJECT(cgpu, MODE_CTRL_WRITE);
|
||||||
|
|
||||||
DEVUNLOCK(cgpu, pstate);
|
err = LIBUSB_ERROR_NO_DEVICE;
|
||||||
|
goto out_unlock;
|
||||||
return LIBUSB_ERROR_NO_DEVICE;
|
|
||||||
}
|
}
|
||||||
usbdev = cgpu->usbdev;
|
usbdev = cgpu->usbdev;
|
||||||
|
|
||||||
@ -2550,6 +2547,7 @@ int _usb_transfer(struct cgpu_info *cgpu, uint8_t request_type, uint8_t bRequest
|
|||||||
if (NODEV(err))
|
if (NODEV(err))
|
||||||
release_cgpu(cgpu);
|
release_cgpu(cgpu);
|
||||||
|
|
||||||
|
out_unlock:
|
||||||
DEVUNLOCK(cgpu, pstate);
|
DEVUNLOCK(cgpu, pstate);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
@ -2570,9 +2568,8 @@ int _usb_transfer_read(struct cgpu_info *cgpu, uint8_t request_type, uint8_t bRe
|
|||||||
if (cgpu->usbinfo.nodev) {
|
if (cgpu->usbinfo.nodev) {
|
||||||
USB_REJECT(cgpu, MODE_CTRL_READ);
|
USB_REJECT(cgpu, MODE_CTRL_READ);
|
||||||
|
|
||||||
DEVUNLOCK(cgpu, pstate);
|
err = LIBUSB_ERROR_NO_DEVICE;
|
||||||
|
goto out_unlock;
|
||||||
return LIBUSB_ERROR_NO_DEVICE;
|
|
||||||
}
|
}
|
||||||
usbdev = cgpu->usbdev;
|
usbdev = cgpu->usbdev;
|
||||||
|
|
||||||
@ -2596,6 +2593,7 @@ int _usb_transfer_read(struct cgpu_info *cgpu, uint8_t request_type, uint8_t bRe
|
|||||||
} else if (NODEV(err))
|
} else if (NODEV(err))
|
||||||
release_cgpu(cgpu);
|
release_cgpu(cgpu);
|
||||||
|
|
||||||
|
out_unlock:
|
||||||
DEVUNLOCK(cgpu, pstate);
|
DEVUNLOCK(cgpu, pstate);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
Loading…
Reference in New Issue
Block a user