summaryrefslogtreecommitdiffstats
path: root/src/libirecovery.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libirecovery.c')
-rw-r--r--src/libirecovery.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/libirecovery.c b/src/libirecovery.c
index cdb0c53..a5b5c84 100644
--- a/src/libirecovery.c
+++ b/src/libirecovery.c
@@ -79,23 +79,21 @@ int irecv_open(irecv_device* device) {
}
int irecv_reset(irecv_device* device) {
- if (device != NULL) {
- if (device->handle != NULL) {
- libusb_reset_device(device->handle);
- }
+ if (device == NULL || device->handle != NULL) {
+ return IRECV_ERROR_NO_DEVICE;
}
+ libusb_reset_device(device->handle);
return IRECV_SUCCESS;
}
int irecv_close(irecv_device* device) {
- if (device != NULL) {
- if (device->handle != NULL) {
- libusb_close(device->handle);
- device->handle = NULL;
- }
+ if (device == NULL || device->handle != NULL) {
+ return IRECV_ERROR_NO_DEVICE;
}
+ libusb_close(device->handle);
+ device->handle = NULL;
return IRECV_SUCCESS;
}