diff --git a/sys/dev/usb/usbdi.c b/sys/dev/usb/usbdi.c index d180da5bc371..83510e672077 100644 --- a/sys/dev/usb/usbdi.c +++ b/sys/dev/usb/usbdi.c @@ -258,13 +258,14 @@ usbd_close_pipe(struct usbd_pipe *pipe) LIST_REMOVE(pipe, up_next); pipe->up_endpoint->ue_refcnt--; + pipe->up_methods->upm_close(pipe); + if (pipe->up_intrxfer != NULL) { usbd_unlock_pipe(pipe); usbd_destroy_xfer(pipe->up_intrxfer); usbd_lock_pipe(pipe); } - pipe->up_methods->upm_close(pipe); usbd_unlock_pipe(pipe); kmem_free(pipe, pipe->up_dev->ud_bus->ub_pipesize);