diff options
author | Nikolai Artemiev <nartemiev@google.com> | 2023-04-19 17:05:25 +1000 |
---|---|---|
committer | Edward O'Callaghan <quasisec@chromium.org> | 2023-04-23 12:29:05 +0000 |
commit | ba18f3e58e6ddd9711e96e1b2b9f5f2337bae1df (patch) | |
tree | 7e8a8fe0f26f25b295a7117cc48da552d149d7b8 | |
parent | 67ca4a71c477320d4b726acd152b7536344e227f (diff) | |
download | flashrom-ba18f3e58e6ddd9711e96e1b2b9f5f2337bae1df.tar.gz flashrom-ba18f3e58e6ddd9711e96e1b2b9f5f2337bae1df.tar.bz2 flashrom-ba18f3e58e6ddd9711e96e1b2b9f5f2337bae1df.zip |
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>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/74537
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Thomas Heijligen <src@posteo.de>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
-rw-r--r-- | usb_device.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/usb_device.c b/usb_device.c index c9c8d92a..0c8e3e21 100644 --- a/usb_device.c +++ b/usb_device.c @@ -342,8 +342,8 @@ int usb_device_claim(struct usb_device *device) } } - 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)); |