diff options
author | Thomas Heijligen <thomas.heijligen@secunet.com> | 2022-08-25 13:43:17 +0200 |
---|---|---|
committer | Thomas Heijligen <src@posteo.de> | 2022-09-07 11:28:36 +0000 |
commit | c0fdc9d108ff59e13ce6b9751f60c22aed153161 (patch) | |
tree | 3492929145d0221eec50c5d41de14c617e19ff1c | |
parent | 5903bb829d8bf67aee290ff4ef141fd76507767c (diff) | |
download | flashrom-c0fdc9d108ff59e13ce6b9751f60c22aed153161.tar.gz flashrom-c0fdc9d108ff59e13ce6b9751f60c22aed153161.tar.bz2 flashrom-c0fdc9d108ff59e13ce6b9751f60c22aed153161.zip |
usb_device.c: release the usb interface on shutdown
Following the libusb documentaion:
`You should release all claimed interfaces before closing a device
handle.`
https://libusb.sourceforge.io/api-1.0/group__libusb__dev.html
libusb_release_interface()
Change-Id: If916574314cd86fad3429065a11707da0a809e0d
Signed-off-by: Thomas Heijligen <thomas.heijligen@secunet.com>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/67072
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
-rw-r--r-- | usb_device.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/usb_device.c b/usb_device.c index b23b20459..b3c966cc7 100644 --- a/usb_device.c +++ b/usb_device.c @@ -381,8 +381,11 @@ struct usb_device *usb_device_free(struct usb_device *device) { struct usb_device *next = device->next; - if (device->handle != NULL) + if (device->handle != NULL) { + libusb_release_interface(device->handle, + device->interface_descriptor->bInterfaceNumber); libusb_close(device->handle); + } /* * This unref balances the ref added in the add_device function. |