From cdfe236931ef3fd06adac0fdf6df49baa39ff35e Mon Sep 17 00:00:00 2001 From: Chris Dickens Date: Wed, 27 Jan 2016 00:27:27 -0800 Subject: [PATCH] Windows (usbdk): Remove unnecessary bookkeeping The core library will not call the backend's exit() function if the init() function does not succeed, so keeping track of whether init() successfully completed is redundant. Signed-off-by: Chris Dickens --- libusb/os/windows_usbdk.c | 8 ++------ libusb/version_nano.h | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/libusb/os/windows_usbdk.c b/libusb/os/windows_usbdk.c index 1d5bddf..c4cb183 100644 --- a/libusb/os/windows_usbdk.c +++ b/libusb/os/windows_usbdk.c @@ -67,7 +67,6 @@ typedef int32_t USBD_STATUS; #endif static int concurrent_usage = -1; -static int init_succeeded = 0; struct usbdk_device_priv { USB_DK_DEVICE_INFO info; @@ -200,7 +199,7 @@ static int usbdk_init(struct libusb_context *ctx) { int r; - if ((++concurrent_usage == 0) || !init_succeeded) { + if (++concurrent_usage == 0) { r = load_usbdk_helper_dll(ctx); if (r) return r; @@ -210,8 +209,6 @@ static int usbdk_init(struct libusb_context *ctx) r = windows_common_init(ctx); if (r) goto error_roll_back; - - init_succeeded = 1; } return LIBUSB_SUCCESS; @@ -368,11 +365,10 @@ func_exit: static void usbdk_exit(void) { - if ((--concurrent_usage < 0) && init_succeeded) { + if (--concurrent_usage < 0) { windows_common_exit(); exit_polling(); unload_usbdk_helper_dll(); - init_succeeded = 0; } } diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 03fcfd4..e5b4908 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11035 +#define LIBUSB_NANO 11036 -- 2.7.4