1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-26 22:52:34 +02:00

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>
This commit is contained in:
Thomas Heijligen 2022-08-25 13:43:17 +02:00 committed by Thomas Heijligen
parent 5903bb829d
commit c0fdc9d108

View File

@ -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.