From 683e3cf21ed37d4492c20cea8de810c4d95ae8b6 Mon Sep 17 00:00:00 2001 From: Tormod Volden Date: Tue, 9 Nov 2021 09:57:57 +0100 Subject: [PATCH] core: Minor code cleanup in libusb_init (NOP) After commit f7084fe the if clause would always be true, so remove it. Thanks to "xloem" for reporting. References #942 Signed-off-by: Tormod Volden --- libusb/core.c | 16 +++++++--------- libusb/version_nano.h | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/libusb/core.c b/libusb/core.c index 03acdd8..7976e4c 100644 --- a/libusb/core.c +++ b/libusb/core.c @@ -2319,16 +2319,14 @@ int API_EXPORTED libusb_init(libusb_context **ctx) list_init(&_ctx->usb_devs); list_init(&_ctx->open_devs); - /* apply options to new contexts (also default context being created) */ - if (ctx || !usbi_default_context) { - for (enum libusb_option option = 0 ; option < LIBUSB_OPTION_MAX ; option++) { - if (LIBUSB_OPTION_LOG_LEVEL == option || !default_context_options[option].is_set) { - continue; - } - r = libusb_set_option(_ctx, option); - if (LIBUSB_SUCCESS != r) - goto err_free_ctx; + /* apply default options to all new contexts */ + for (enum libusb_option option = 0 ; option < LIBUSB_OPTION_MAX ; option++) { + if (LIBUSB_OPTION_LOG_LEVEL == option || !default_context_options[option].is_set) { + continue; } + r = libusb_set_option(_ctx, option); + if (LIBUSB_SUCCESS != r) + goto err_free_ctx; } /* default context must be initialized before calling usbi_dbg */ diff --git a/libusb/version_nano.h b/libusb/version_nano.h index 09d6e2e..ee61cdd 100644 --- a/libusb/version_nano.h +++ b/libusb/version_nano.h @@ -1 +1 @@ -#define LIBUSB_NANO 11674 +#define LIBUSB_NANO 11675 -- 2.7.4