Index: uspace/drv/uhci-hcd/batch.h
===================================================================
--- uspace/drv/uhci-hcd/batch.h	(revision e247d83f26c1f9fc072e178ccded2ab08a6893c0)
+++ uspace/drv/uhci-hcd/batch.h	(revision 563ead9c368591330423b755226a950d0f735d2e)
@@ -35,8 +35,4 @@
 #define DRV_UHCI_BATCH_H
 
-#include <usbhc_iface.h>
-#include <usb/usb.h>
-#include <usb/host/device_keeper.h>
-#include <usb/host/endpoint.h>
 #include <usb/host/batch.h>
 
Index: uspace/drv/uhci-hcd/hc.c
===================================================================
--- uspace/drv/uhci-hcd/hc.c	(revision e247d83f26c1f9fc072e178ccded2ab08a6893c0)
+++ uspace/drv/uhci-hcd/hc.c	(revision 563ead9c368591330423b755226a950d0f735d2e)
@@ -39,6 +39,4 @@
 #include <usb/debug.h>
 #include <usb/usb.h>
-#include <usb/ddfiface.h>
-#include <usb_iface.h>
 
 #include "hc.h"
Index: uspace/drv/uhci-hcd/hc.h
===================================================================
--- uspace/drv/uhci-hcd/hc.h	(revision e247d83f26c1f9fc072e178ccded2ab08a6893c0)
+++ uspace/drv/uhci-hcd/hc.h	(revision 563ead9c368591330423b755226a950d0f735d2e)
@@ -37,13 +37,10 @@
 
 #include <fibril.h>
-#include <fibril_synch.h>
-#include <adt/list.h>
 #include <ddi.h>
 
-#include <usbhc_iface.h>
 #include <usb/host/device_keeper.h>
 #include <usb/host/usb_endpoint_manager.h>
+#include <usb/host/batch.h>
 
-#include "batch.h"
 #include "transfer_list.h"
 
Index: uspace/drv/uhci-hcd/iface.c
===================================================================
--- uspace/drv/uhci-hcd/iface.c	(revision e247d83f26c1f9fc072e178ccded2ab08a6893c0)
+++ uspace/drv/uhci-hcd/iface.c	(revision 563ead9c368591330423b755226a950d0f735d2e)
@@ -39,4 +39,5 @@
 
 #include "iface.h"
+#include "batch.h"
 #include "hc.h"
 
@@ -122,5 +123,5 @@
 	return EOK;
 }
-
+/*----------------------------------------------------------------------------*/
 /** Find device handle by address interface function.
  *
@@ -136,9 +137,8 @@
 	hc_t *hc = fun_to_hc(fun);
 	assert(hc);
-	bool found =
+	const bool found =
 	    usb_device_keeper_find_by_address(&hc->manager, address, handle);
 	return found ? EOK : ENOENT;
 }
-
 /*----------------------------------------------------------------------------*/
 /** Release address interface function
@@ -164,4 +164,5 @@
     size_t max_packet_size, unsigned int interval)
 {
+	assert(fun);
 	hc_t *hc = fun_to_hc(fun);
 	assert(hc);
@@ -183,4 +184,5 @@
     usb_endpoint_t endpoint, usb_direction_t direction)
 {
+	assert(fun);
 	hc_t *hc = fun_to_hc(fun);
 	assert(hc);
@@ -211,4 +213,6 @@
 	if (ret != EOK)
 		return ret;
+	assert(batch);
+	assert(hc);
 	batch_interrupt_out(batch);
 	ret = hc_schedule(hc, batch);
@@ -239,4 +243,6 @@
 	if (ret != EOK)
 		return ret;
+	assert(batch);
+	assert(hc);
 	batch_interrupt_in(batch);
 	ret = hc_schedule(hc, batch);
@@ -267,4 +273,6 @@
 	if (ret != EOK)
 		return ret;
+	assert(batch);
+	assert(hc);
 	batch_bulk_out(batch);
 	ret = hc_schedule(hc, batch);
@@ -295,4 +303,6 @@
 	if (ret != EOK)
 		return ret;
+	assert(batch);
+	assert(hc);
 	batch_bulk_in(batch);
 	ret = hc_schedule(hc, batch);
@@ -327,4 +337,6 @@
 	if (ret != EOK)
 		return ret;
+	assert(batch);
+	assert(hc);
 	usb_endpoint_manager_reset_if_need(&hc->ep_manager, target, setup_data);
 	batch_control_write(batch);
@@ -360,4 +372,6 @@
 	if (ret != EOK)
 		return ret;
+	assert(batch);
+	assert(hc);
 	batch_control_read(batch);
 	ret = hc_schedule(hc, batch);
Index: uspace/drv/uhci-hcd/root_hub.h
===================================================================
--- uspace/drv/uhci-hcd/root_hub.h	(revision e247d83f26c1f9fc072e178ccded2ab08a6893c0)
+++ uspace/drv/uhci-hcd/root_hub.h	(revision 563ead9c368591330423b755226a950d0f735d2e)
@@ -43,5 +43,5 @@
 	/** List of resources available to the root hub. */
 	hw_resource_list_t resource_list;
-	/** The only resource in the above list */
+	/** The only resource in the RH resource list */
 	hw_resource_t io_regs;
 } rh_t;
Index: uspace/drv/uhci-hcd/transfer_list.c
===================================================================
--- uspace/drv/uhci-hcd/transfer_list.c	(revision e247d83f26c1f9fc072e178ccded2ab08a6893c0)
+++ uspace/drv/uhci-hcd/transfer_list.c	(revision 563ead9c368591330423b755226a950d0f735d2e)
@@ -36,5 +36,7 @@
 #include <arch/barrier.h>
 
+
 #include "transfer_list.h"
+#include "batch.h"
 
 static void transfer_list_remove_batch(
Index: uspace/drv/uhci-hcd/transfer_list.h
===================================================================
--- uspace/drv/uhci-hcd/transfer_list.h	(revision e247d83f26c1f9fc072e178ccded2ab08a6893c0)
+++ uspace/drv/uhci-hcd/transfer_list.h	(revision 563ead9c368591330423b755226a950d0f735d2e)
@@ -36,6 +36,6 @@
 
 #include <fibril_synch.h>
+#include <usb/host/batch.h>
 
-#include "batch.h"
 #include "hw_struct/queue_head.h"
 
Index: uspace/drv/uhci-hcd/utils/malloc32.h
===================================================================
--- uspace/drv/uhci-hcd/utils/malloc32.h	(revision e247d83f26c1f9fc072e178ccded2ab08a6893c0)
+++ uspace/drv/uhci-hcd/utils/malloc32.h	(revision 563ead9c368591330423b755226a950d0f735d2e)
@@ -59,6 +59,4 @@
 	uintptr_t result;
 	const int ret = as_get_physical_mapping(addr, &result);
-	assert(ret == EOK);
-
 	if (ret != EOK)
 		return 0;
@@ -98,5 +96,4 @@
 {
 	void *free_address = as_get_mappable_page(UHCI_REQUIRED_PAGE_SIZE);
-	assert(free_address); /* TODO: remove this assert */
 	if (free_address == 0)
 		return NULL;
Index: uspace/drv/uhci-rhd/main.c
===================================================================
--- uspace/drv/uhci-rhd/main.c	(revision e247d83f26c1f9fc072e178ccded2ab08a6893c0)
+++ uspace/drv/uhci-rhd/main.c	(revision 563ead9c368591330423b755226a950d0f735d2e)
@@ -37,4 +37,5 @@
 #include <errno.h>
 #include <str_error.h>
+
 #include <usb_iface.h>
 #include <usb/ddfiface.h>
@@ -45,5 +46,5 @@
 #define NAME "uhci-rhd"
 
-static int hc_get_my_registers(ddf_dev_t *dev,
+static int hc_get_my_registers(const ddf_dev_t *dev,
     uintptr_t *io_reg_address, size_t *io_reg_size);
 /*----------------------------------------------------------------------------*/
@@ -130,9 +131,9 @@
  */
 int hc_get_my_registers(
-    ddf_dev_t *dev, uintptr_t *io_reg_address, size_t *io_reg_size)
+    const ddf_dev_t *dev, uintptr_t *io_reg_address, size_t *io_reg_size)
 {
-	assert(dev != NULL);
+	assert(dev);
 
-	int parent_phone = devman_parent_device_connect(dev->handle,
+	const int parent_phone = devman_parent_device_connect(dev->handle,
 	    IPC_FLAG_BLOCKING);
 	if (parent_phone < 0) {
@@ -141,5 +142,5 @@
 
 	hw_resource_list_t hw_resources;
-	int ret = hw_res_get_resource_list(parent_phone, &hw_resources);
+	const int ret = hw_res_get_resource_list(parent_phone, &hw_resources);
 	if (ret != EOK) {
 		async_hangup(parent_phone);
Index: uspace/drv/uhci-rhd/port.c
===================================================================
--- uspace/drv/uhci-rhd/port.c	(revision e247d83f26c1f9fc072e178ccded2ab08a6893c0)
+++ uspace/drv/uhci-rhd/port.c	(revision 563ead9c368591330423b755226a950d0f735d2e)
@@ -36,5 +36,4 @@
 #include <errno.h>
 #include <str_error.h>
-#include <time.h>
 #include <async.h>
 
@@ -82,5 +81,5 @@
  * @param[in] number Port number.
  * @param[in] usec Polling interval.
- * @param[in] rh Pointer to ddf instance fo the root hub driver.
+ * @param[in] rh Pointer to ddf instance of the root hub driver.
  * @return Error code.
  *
@@ -91,9 +90,11 @@
 {
 	assert(port);
-	asprintf(&port->id_string, "Port (%p - %u)", port, number);
-	if (port->id_string == NULL) {
+	char *id_string;
+	asprintf(&id_string, "Port (%p - %u)", port, number);
+	if (id_string == NULL) {
 		return ENOMEM;
 	}
 
+	port->id_string = id_string;
 	port->address = address;
 	port->number = number;
@@ -105,5 +106,7 @@
 	    usb_hc_connection_initialize_from_device(&port->hc_connection, rh);
 	if (ret != EOK) {
-		usb_log_error("Failed to initialize connection to HC.");
+		usb_log_error("%s: failed to initialize connection to HC.",
+		    port->id_string);
+		free(id_string);
 		return ret;
 	}
@@ -113,4 +116,5 @@
 		usb_log_error("%s: failed to create polling fibril.",
 		    port->id_string);
+		free(id_string);
 		return ENOMEM;
 	}
@@ -132,5 +136,5 @@
 	assert(port);
 	free(port->id_string);
-	/* TODO: Kill fibril here */
+	// TODO: Kill fibril here
 	return;
 }
@@ -150,5 +154,6 @@
 
 		/* Read register value */
-		port_status_t port_status = uhci_port_read_status(instance);
+		const port_status_t port_status =
+		    uhci_port_read_status(instance);
 
 		/* Print the value if it's interesting */
@@ -161,12 +166,4 @@
 		usb_log_debug("%s: Connected change detected: %x.\n",
 		    instance->id_string, port_status);
-
-		int rc =
-		    usb_hc_connection_open(&instance->hc_connection);
-		if (rc != EOK) {
-			usb_log_error("%s: Failed to connect to HC.",
-			    instance->id_string);
-			continue;
-		}
 
 		/* Remove any old device */
@@ -175,4 +172,12 @@
 			    instance->id_string);
 			uhci_port_remove_device(instance);
+		}
+
+		int ret =
+		    usb_hc_connection_open(&instance->hc_connection);
+		if (ret != EOK) {
+			usb_log_error("%s: Failed to connect to HC.",
+			    instance->id_string);
+			continue;
 		}
 
@@ -190,6 +195,6 @@
 		}
 
-		rc = usb_hc_connection_close(&instance->hc_connection);
-		if (rc != EOK) {
+		ret = usb_hc_connection_close(&instance->hc_connection);
+		if (ret != EOK) {
 			usb_log_error("%s: Failed to disconnect.",
 			    instance->id_string);
@@ -210,4 +215,5 @@
 {
 	uhci_port_t *port = arg;
+	assert(port);
 
 	usb_log_debug2("%s: new_device_enable_port.\n", port->id_string);
@@ -283,4 +289,5 @@
 	usb_log_error("%s: Don't know how to remove device %" PRIun ".\n",
 	    port->id_string, port->attached_device);
+	port->attached_device = 0;
 	return ENOTSUP;
 }
Index: uspace/drv/uhci-rhd/port.h
===================================================================
--- uspace/drv/uhci-rhd/port.h	(revision e247d83f26c1f9fc072e178ccded2ab08a6893c0)
+++ uspace/drv/uhci-rhd/port.h	(revision 563ead9c368591330423b755226a950d0f735d2e)
@@ -57,5 +57,5 @@
 typedef struct uhci_port
 {
-	char *id_string;
+	const char *id_string;
 	port_status_t *address;
 	unsigned number;
