Index: uspace/drv/bus/usb/xhci/bus.c
===================================================================
--- uspace/drv/bus/usb/xhci/bus.c	(revision 889146e9b7a3599240dc6e7f9960962f5c52db8c)
+++ uspace/drv/bus/usb/xhci/bus.c	(revision 53db8068ef5d5a8f7d8f1e1c66a6145c61251652)
@@ -180,5 +180,4 @@
 	}
 
-	fibril_mutex_lock(&bus->base.guard);
 	/* Assign an address to the device */
 	if ((err = address_device(hc, xhci_dev))) {
@@ -187,12 +186,14 @@
 	}
 
+	/* Setup EP0 might already need to issue a transfer. */
+	fibril_mutex_lock(&bus->base.guard);
+	assert(bus->devices_by_slot[xhci_dev->slot_id] == NULL);
+	bus->devices_by_slot[xhci_dev->slot_id] = xhci_dev;
+	fibril_mutex_unlock(&bus->base.guard);
+
 	if ((err = setup_ep0_packet_size(hc, xhci_dev))) {
 		usb_log_error("Failed to setup control endpoint of the new device: %s", str_error(err));
 		goto err_address;
 	}
-
-	assert(bus->devices_by_slot[xhci_dev->slot_id] == NULL);
-	bus->devices_by_slot[xhci_dev->slot_id] = xhci_dev;
-	fibril_mutex_unlock(&bus->base.guard);
 
 	/* Read the device descriptor, derive the match ids */
