From fcfd7c299915ff1bc3117f6b01d4150b430dd0e6 Mon Sep 17 00:00:00 2001 From: Miklos Marton Date: Wed, 15 Jan 2025 10:43:39 +0100 Subject: [PATCH] Only claim interface if the open was successful --- src/common/stlink_interface.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/stlink_interface.cpp b/src/common/stlink_interface.cpp index c7d09dc..64ea138 100644 --- a/src/common/stlink_interface.cpp +++ b/src/common/stlink_interface.cpp @@ -228,8 +228,8 @@ STLinkInterface::STLink_OpenDevice(TEnumStlinkInterface IfId, libusb_device *dev = devices[DevIdxInList]; libusb_device_handle *handle = nullptr; int ret = libusb_open(dev, &handle); - libusb_claim_interface(handle, 4); if (LIBUSB_SUCCESS == ret) { + libusb_claim_interface(handle, 4); *pHandle = handle; return SS_OK; }