Index: uspace/drv/uhci-hcd/transfer_list.c
===================================================================
--- uspace/drv/uhci-hcd/transfer_list.c	(revision 4fd3faf06b8a4954818da61d7c31ecaba4839d5c)
+++ uspace/drv/uhci-hcd/transfer_list.c	(revision cfbbe1d3a9a94acf026279720b2b199d8893f400)
@@ -57,7 +57,7 @@
 		return ENOMEM;
 	}
-	instance->queue_head_pa = addr_to_phys(instance->queue_head);
+	uint32_t queue_head_pa = addr_to_phys(instance->queue_head);
 	usb_log_debug2("Transfer list %s setup with QH: %p(%p).\n",
-	    name, instance->queue_head, instance->queue_head_pa);
+	    name, instance->queue_head, queue_head_pa);
 
 	qh_init(instance->queue_head);
@@ -67,4 +67,15 @@
 }
 /*----------------------------------------------------------------------------*/
+/** Dispose transfer list structures.
+ *
+ * @param[in] instance Memory place to use.
+ *
+ * Frees memory for internal qh_t structure.
+ */
+void transfer_list_fini(transfer_list_t *instance)
+{
+	assert(instance);
+	free32(instance->queue_head);
+}
 /** Set the next list in transfer list chain.
  *
@@ -81,13 +92,12 @@
 	if (!instance->queue_head)
 		return;
-	/* Set both queue_head.next to point to the follower */
-	qh_set_next_qh(instance->queue_head, next->queue_head_pa);
-}
-/*----------------------------------------------------------------------------*/
-/** Submit transfer batch to the list and queue.
+	/* Set queue_head.next to point to the follower */
+	qh_set_next_qh(instance->queue_head, next->queue_head);
+}
+/*----------------------------------------------------------------------------*/
+/** Add transfer batch to the list and queue.
  *
  * @param[in] instance List to use.
  * @param[in] batch Transfer batch to submit.
- * @return Error code
  *
  * The batch is added to the end of the list and queue.
@@ -109,6 +119,6 @@
 	} else {
 		/* There is something scheduled */
-		usb_transfer_batch_t *last = list_get_instance(
-		    instance->batch_list.prev, usb_transfer_batch_t, link);
+		usb_transfer_batch_t *last =
+		    usb_transfer_batch_from_link(instance->batch_list.prev);
 		last_qh = batch_qh(last);
 	}
@@ -118,5 +128,5 @@
 	/* keep link */
 	batch_qh(batch)->next = last_qh->next;
-	qh_set_next_qh(last_qh, pa);
+	qh_set_next_qh(last_qh, batch_qh(batch));
 
 	asm volatile ("": : :"memory");
@@ -132,5 +142,5 @@
 }
 /*----------------------------------------------------------------------------*/
-/** Create list for finished batches.
+/** Add completed bantches to the provided list.
  *
  * @param[in] instance List to use.
@@ -147,8 +157,8 @@
 		link_t *next = current->next;
 		usb_transfer_batch_t *batch =
-		    list_get_instance(current, usb_transfer_batch_t, link);
+		    usb_transfer_batch_from_link(current);
 
 		if (batch_is_complete(batch)) {
-			/* Save for post-processing */
+			/* Save for processing */
 			transfer_list_remove_batch(instance, batch);
 			list_append(current, done);
@@ -159,5 +169,5 @@
 }
 /*----------------------------------------------------------------------------*/
-/** Walk the list and abort all batches.
+/** Walk the list and finish all batches with EINTR.
  *
  * @param[in] instance List to use.
@@ -169,7 +179,7 @@
 		link_t *current = instance->batch_list.next;
 		usb_transfer_batch_t *batch =
-		    list_get_instance(current, usb_transfer_batch_t, link);
+		    usb_transfer_batch_from_link(current);
 		transfer_list_remove_batch(instance, batch);
-		usb_transfer_batch_finish_error(batch, EIO);
+		usb_transfer_batch_finish_error(batch, EINTR);
 	}
 	fibril_mutex_unlock(&instance->guard);
@@ -180,5 +190,4 @@
  * @param[in] instance List to use.
  * @param[in] batch Transfer batch to remove.
- * @return Error code
  *
  * Does not lock the transfer list, caller is responsible for that.
@@ -197,24 +206,24 @@
 
 	const char *qpos = NULL;
+	qh_t *prev_qh = NULL;
 	/* Remove from the hardware queue */
 	if (instance->batch_list.next == &batch->link) {
 		/* I'm the first one here */
-		assert((instance->queue_head->next & LINK_POINTER_ADDRESS_MASK)
-		    == addr_to_phys(batch_qh(batch)));
-		instance->queue_head->next = batch_qh(batch)->next;
+		prev_qh = instance->queue_head;
 		qpos = "FIRST";
 	} else {
+		/* The thing before me is a batch too */
 		usb_transfer_batch_t *prev =
-		    list_get_instance(
-		        batch->link.prev, usb_transfer_batch_t, link);
-		assert((batch_qh(prev)->next & LINK_POINTER_ADDRESS_MASK)
-		    == addr_to_phys(batch_qh(batch)));
-		batch_qh(prev)->next = batch_qh(batch)->next;
+		    usb_transfer_batch_from_link(batch->link.prev);
+		prev_qh = batch_qh(prev);
 		qpos = "NOT FIRST";
 	}
+	assert((prev_qh->next & LINK_POINTER_ADDRESS_MASK)
+	    == addr_to_phys(batch_qh(batch)));
+	prev_qh->next = batch_qh(batch)->next;
 	asm volatile ("": : :"memory");
 	/* Remove from the batch list */
 	list_remove(&batch->link);
-	usb_log_debug("Batch(%p) removed (%s) from %s, next %x.\n",
+	usb_log_debug("Batch(%p) removed (%s) from %s, next: %x.\n",
 	    batch, qpos, instance->name, batch_qh(batch)->next);
 }
