From 5bbd277ce71521a3898697e4c8cb25ed65990f9c Mon Sep 17 00:00:00 2001 From: Joshua Hill Date: Thu, 13 May 2010 07:06:45 -0400 Subject: Cleaned up irecv_reset(), and irecv_close() to make sure they were returning error if there really was an error --- src/libirecovery.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'src') 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; } -- cgit v1.1-32-gdbae