aboutsummaryrefslogtreecommitdiffstats
path: root/tools/usb/usbip/src/usbip_port.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/usb/usbip/src/usbip_port.c')
-rw-r--r--tools/usb/usbip/src/usbip_port.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/usb/usbip/src/usbip_port.c b/tools/usb/usbip/src/usbip_port.c
index a2e884fd9226..7bd74fb3a9cd 100644
--- a/tools/usb/usbip/src/usbip_port.c
+++ b/tools/usb/usbip/src/usbip_port.c
@@ -22,10 +22,13 @@ static int list_imported_devices(void)
struct usbip_imported_device *idev;
int ret;
+ if (usbip_names_init(USBIDS_FILE))
+ err("failed to open %s", USBIDS_FILE);
+
ret = usbip_vhci_driver_open();
if (ret < 0) {
err("open vhci_driver");
- return -1;
+ goto err_names_free;
}
printf("Imported USB devices\n");
@@ -35,13 +38,19 @@ static int list_imported_devices(void)
idev = &vhci_driver->idev[i];
if (usbip_vhci_imported_device_dump(idev) < 0)
- ret = -1;
+ goto err_driver_close;
}
usbip_vhci_driver_close();
+ usbip_names_free();
return ret;
+err_driver_close:
+ usbip_vhci_driver_close();
+err_names_free:
+ usbip_names_free();
+ return -1;
}
int usbip_port_show(__attribute__((unused)) int argc,