summaryrefslogtreecommitdiffstats
path: root/tools/usb/usbip/src/usbip_detach.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/usb/usbip/src/usbip_detach.c')
-rw-r--r--tools/usb/usbip/src/usbip_detach.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/usb/usbip/src/usbip_detach.c b/tools/usb/usbip/src/usbip_detach.c
index 05c6d15856eb..b4356ed875e5 100644
--- a/tools/usb/usbip/src/usbip_detach.c
+++ b/tools/usb/usbip/src/usbip_detach.c
@@ -43,7 +43,7 @@ void usbip_detach_usage(void)
static int detach_port(char *port)
{
- int ret;
+ int ret = 0;
uint8_t portnum;
char path[PATH_MAX+1];
@@ -71,9 +71,12 @@ static int detach_port(char *port)
}
ret = usbip_vhci_detach_device(portnum);
- if (ret < 0)
- return -1;
+ if (ret < 0) {
+ ret = -1;
+ goto call_driver_close;
+ }
+call_driver_close:
usbip_vhci_driver_close();
return ret;