Nikolai Artemiev has uploaded this change for review.

View Change

usb_device.c: remove LIBUSB() wrapper around call that may fail

The libusb_detach_kernel_driver() call may return
LIBUSB_ERROR_NOT_FOUND, which should not be treated as an error.

Wrapping the call in LIBUSB() caused the error code to be transformed by
LIBUSB_ERROR(), so LIBUSB_ERROR_NOT_FOUND was not recognized at the call
site and was treated as a real error.

BUG=b:278635575
TEST=flashrom -p raiden_debug_spi:target=AP
BRANCH=none

Change-Id: I38e4642bcbddaf3f37821093f6b919806134ed7b
Signed-off-by: Nikolai Artemiev <nartemiev@google.com>
---
M usb_device.c
1 file changed, 23 insertions(+), 2 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/37/74537/1
diff --git a/usb_device.c b/usb_device.c
index c9c8d92..0c8e3e2 100644
--- a/usb_device.c
+++ b/usb_device.c
@@ -342,8 +342,8 @@
}
}

- ret = LIBUSB(libusb_detach_kernel_driver(device->handle,
- device->interface_descriptor->bInterfaceNumber));
+ ret = libusb_detach_kernel_driver(device->handle,
+ device->interface_descriptor->bInterfaceNumber);
if (ret != 0 && ret != LIBUSB_ERROR_NOT_FOUND && ret != LIBUSB_ERROR_NOT_SUPPORTED) {
msg_perr("Cannot detach the existing usb driver. %s\n",
libusb_error_name(ret));

To view, visit change 74537. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I38e4642bcbddaf3f37821093f6b919806134ed7b
Gerrit-Change-Number: 74537
Gerrit-PatchSet: 1
Gerrit-Owner: Nikolai Artemiev <nartemiev@google.com>
Gerrit-MessageType: newchange