Index: uspace/drv/bus/usb/xhci/endpoint.c
===================================================================
--- uspace/drv/bus/usb/xhci/endpoint.c	(revision 2e5aea1793c59721de23e0320a1e7f8f2aebc260)
+++ uspace/drv/bus/usb/xhci/endpoint.c	(revision 2c091a6813c05f6aabf618e99280e40d636e89d1)
@@ -203,5 +203,4 @@
 	// Prepare input context.
 	xhci_input_ctx_t *ictx = malloc32(sizeof(xhci_input_ctx_t));
-	const unsigned ep_idx = xhci_endpoint_index(ep);
 	if (!ictx)
 		goto err;
@@ -214,4 +213,6 @@
 	XHCI_INPUT_CTRL_CTX_DROP_CLEAR(ictx->ctrl_ctx, 1);
 	XHCI_INPUT_CTRL_CTX_ADD_SET(ictx->ctrl_ctx, 0);
+
+	const unsigned ep_idx = xhci_endpoint_index(ep);
 	XHCI_INPUT_CTRL_CTX_ADD_SET(ictx->ctrl_ctx, ep_idx + 1); /* Preceded by slot ctx */
 
@@ -255,5 +256,5 @@
 	free32(ictx);
 err:
-	dev->endpoints[ep_idx] = NULL;
+	dev->endpoints[ep_num] = NULL;
 	dev->active_endpoint_count--;
 	return err;
