Index: uspace/drv/uhci-rhd/main.c
===================================================================
--- uspace/drv/uhci-rhd/main.c	(revision ccbcd895e1a6389190a7f195e2e8763c14de33df)
+++ uspace/drv/uhci-rhd/main.c	(revision f9c03b5741ded16234379e99ce809ea66a8b9f6c)
@@ -44,71 +44,9 @@
 
 #define NAME "uhci-rhd"
+
 static int hc_get_my_registers(ddf_dev_t *dev,
     uintptr_t *io_reg_address, size_t *io_reg_size);
-#if 0
 /*----------------------------------------------------------------------------*/
-static int usb_iface_get_hc_handle(ddf_fun_t *fun, devman_handle_t *handle)
-{
-	assert(fun);
-	assert(fun->driver_data);
-	assert(handle);
-
-	*handle = ((uhci_root_hub_t*)fun->driver_data)->hc_handle;
-
-	return EOK;
-}
-/*----------------------------------------------------------------------------*/
-static usb_iface_t uhci_rh_usb_iface = {
-	.get_hc_handle = usb_iface_get_hc_handle,
-	.get_address = usb_iface_get_address_hub_impl
-};
-/*----------------------------------------------------------------------------*/
-static ddf_dev_ops_t uhci_rh_ops = {
-	.interfaces[USB_DEV_IFACE] = &uhci_rh_usb_iface,
-};
-#endif
-/*----------------------------------------------------------------------------*/
-/** Initialize a new ddf driver instance of UHCI root hub.
- *
- * @param[in] device DDF instance of the device to initialize.
- * @return Error code.
- */
-static int uhci_rh_add_device(ddf_dev_t *device)
-{
-	if (!device)
-		return ENOTSUP;
-
-	usb_log_debug2("%s called device %d\n", __FUNCTION__, device->handle);
-
-	//device->ops = &uhci_rh_ops;
-	uintptr_t io_regs = 0;
-	size_t io_size = 0;
-
-	int ret = hc_get_my_registers(device, &io_regs, &io_size);
-	if (ret != EOK) {
-		usb_log_error("Failed to get registers from parent HC: %s.\n",
-		    str_error(ret));
-	}
-	usb_log_debug("I/O regs at %#X (size %zu).\n", io_regs, io_size);
-
-	uhci_root_hub_t *rh = malloc(sizeof(uhci_root_hub_t));
-	if (!rh) {
-		usb_log_error("Failed to allocate driver instance.\n");
-		return ENOMEM;
-	}
-
-	ret = uhci_root_hub_init(rh, (void*)io_regs, io_size, device);
-	if (ret != EOK) {
-		usb_log_error("Failed to initialize driver instance: %s.\n",
-		    str_error(ret));
-		free(rh);
-		return ret;
-	}
-
-	device->driver_data = rh;
-	usb_log_info("Controlling root hub `%s' (%llu).\n",
-	    device->name, device->handle);
-	return EOK;
-}
+static int uhci_rh_add_device(ddf_dev_t *device);
 /*----------------------------------------------------------------------------*/
 static driver_ops_t uhci_rh_driver_ops = {
@@ -132,8 +70,52 @@
 {
 	printf(NAME ": HelenOS UHCI root hub driver.\n");
+	usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
+	return ddf_driver_main(&uhci_rh_driver);
+}
+/*----------------------------------------------------------------------------*/
+/** Initialize a new ddf driver instance of UHCI root hub.
+ *
+ * @param[in] device DDF instance of the device to initialize.
+ * @return Error code.
+ */
+static int uhci_rh_add_device(ddf_dev_t *device)
+{
+	if (!device)
+		return EINVAL;
 
-	usb_log_enable(USB_LOG_LEVEL_DEFAULT, NAME);
+	usb_log_debug2("%s called device %d\n", __FUNCTION__, device->handle);
 
-	return ddf_driver_main(&uhci_rh_driver);
+	uintptr_t io_regs = 0;
+	size_t io_size = 0;
+	uhci_root_hub_t *rh = NULL;
+	int ret = EOK;
+
+#define CHECK_RET_FREE_RH_RETURN(ret, message...) \
+if (ret != EOK) { \
+	usb_log_error(message); \
+	if (rh) \
+		free(rh); \
+	return ret; \
+} else (void)0
+
+	ret = hc_get_my_registers(device, &io_regs, &io_size);
+	CHECK_RET_FREE_RH_RETURN(ret,
+	    "Failed(%d) to get registers from HC: %s.\n", ret, str_error(ret));
+	usb_log_debug("I/O regs at %#x (size %zu).\n", io_regs, io_size);
+
+	rh = malloc(sizeof(uhci_root_hub_t));
+	ret = (rh == NULL) ? ENOMEM : EOK;
+	CHECK_RET_FREE_RH_RETURN(ret,
+	    "Failed to allocate rh driver instance.\n");
+
+	ret = uhci_root_hub_init(rh, (void*)io_regs, io_size, device);
+	CHECK_RET_FREE_RH_RETURN(ret,
+	    "Failed(%d) to initialize rh driver instance: %s.\n",
+	    ret, str_error(ret));
+
+	device->driver_data = rh;
+	usb_log_info("Controlling root hub '%s' (%llu).\n",
+	    device->name, device->handle);
+	return EOK;
 }
 /*----------------------------------------------------------------------------*/
@@ -156,10 +138,9 @@
 	}
 
-	int rc;
-
 	hw_resource_list_t hw_resources;
-	rc = hw_res_get_resource_list(parent_phone, &hw_resources);
-	if (rc != EOK) {
-		goto leave;
+	int ret = hw_res_get_resource_list(parent_phone, &hw_resources);
+	if (ret != EOK) {
+		async_hangup(parent_phone);
+		return ret;
 	}
 
@@ -168,24 +149,18 @@
 	bool io_found = false;
 
-	size_t i;
-	for (i = 0; i < hw_resources.count; i++) {
+	size_t i = 0;
+	for (; i < hw_resources.count; i++) {
 		hw_resource_t *res = &hw_resources.resources[i];
-		switch (res->type)
-		{
-		case IO_RANGE:
-			io_address = (uintptr_t) res->res.io_range.address;
+		if (res->type == IO_RANGE) {
+			io_address = res->res.io_range.address;
 			io_size = res->res.io_range.size;
 			io_found = true;
-
-		default:
-			break;
 		}
 	}
+	async_hangup(parent_phone);
 
 	if (!io_found) {
-		rc = ENOENT;
-		goto leave;
+		return ENOENT;
 	}
-
 	if (io_reg_address != NULL) {
 		*io_reg_address = io_address;
@@ -194,9 +169,5 @@
 		*io_reg_size = io_size;
 	}
-	rc = EOK;
-
-leave:
-	async_hangup(parent_phone);
-	return rc;
+	return EOK;
 }
 /**
Index: uspace/drv/uhci-rhd/port.c
===================================================================
--- uspace/drv/uhci-rhd/port.c	(revision ccbcd895e1a6389190a7f195e2e8763c14de33df)
+++ uspace/drv/uhci-rhd/port.c	(revision f9c03b5741ded16234379e99ce809ea66a8b9f6c)
@@ -43,9 +43,9 @@
 #include "port.h"
 
+static int uhci_port_check(void *port);
+static int uhci_port_reset_enable(int portno, void *arg);
 static int uhci_port_new_device(uhci_port_t *port, usb_speed_t speed);
 static int uhci_port_remove_device(uhci_port_t *port);
 static int uhci_port_set_enabled(uhci_port_t *port, bool enabled);
-static int uhci_port_check(void *port);
-static int uhci_port_reset_enable(int portno, void *arg);
 static void uhci_port_print_status(
     uhci_port_t *port, const port_status_t value);
@@ -74,5 +74,4 @@
 	pio_write_16(port->address, value);
 }
-
 /*----------------------------------------------------------------------------*/
 /** Initialize UHCI root hub port instance.
@@ -259,13 +258,13 @@
 
 	usb_address_t dev_addr;
-	int rc = usb_hc_new_device_wrapper(port->rh, &port->hc_connection,
+	int ret = usb_hc_new_device_wrapper(port->rh, &port->hc_connection,
 	    speed, uhci_port_reset_enable, port->number, port,
 	    &dev_addr, &port->attached_device, NULL, NULL, NULL);
 
-	if (rc != EOK) {
+	if (ret != EOK) {
 		usb_log_error("%s: Failed(%d) to add device: %s.\n",
-		    port->id_string, rc, str_error(rc));
+		    port->id_string, ret, str_error(ret));
 		uhci_port_set_enabled(port, false);
-		return rc;
+		return ret;
 	}
 
@@ -287,7 +286,7 @@
 int uhci_port_remove_device(uhci_port_t *port)
 {
-	usb_log_error("%s: Don't know how to remove device %d.\n",
-	    port->id_string, (unsigned int)port->attached_device);
-	return EOK;
+	usb_log_error("%s: Don't know how to remove device %llu.\n",
+	    port->id_string, port->attached_device);
+	return ENOTSUP;
 }
 /*----------------------------------------------------------------------------*/
@@ -341,5 +340,5 @@
 	    (value & STATUS_CONNECTED_CHANGED) ? " CONNECTED-CHANGE," : "",
 	    (value & STATUS_CONNECTED) ? " CONNECTED," : "",
-	    (value & STATUS_ALWAYS_ONE) ? " ALWAYS ONE" : " ERROR: NO ALWAYS ONE"
+	    (value & STATUS_ALWAYS_ONE) ? " ALWAYS ONE" : " ERR: NO ALWAYS ONE"
 	);
 }
Index: uspace/drv/uhci-rhd/root_hub.c
===================================================================
--- uspace/drv/uhci-rhd/root_hub.c	(revision ccbcd895e1a6389190a7f195e2e8763c14de33df)
+++ uspace/drv/uhci-rhd/root_hub.c	(revision f9c03b5741ded16234379e99ce809ea66a8b9f6c)
@@ -51,10 +51,9 @@
 	assert(instance);
 	assert(rh);
-	int ret;
 
 	/* Allow access to root hub port registers */
 	assert(sizeof(port_status_t) * UHCI_ROOT_HUB_PORT_COUNT <= size);
 	port_status_t *regs;
-	ret = pio_enable(addr, size, (void**)&regs);
+	int ret = pio_enable(addr, size, (void**)&regs);
 	if (ret < 0) {
 		usb_log_error(
@@ -84,7 +83,6 @@
  *
  * @param[in] instance Root hub structure to use.
- * @return Error code.
  */
-int uhci_root_hub_fini(uhci_root_hub_t* instance)
+void uhci_root_hub_fini(uhci_root_hub_t* instance)
 {
 	assert(instance);
@@ -93,5 +91,4 @@
 		uhci_port_fini(&instance->ports[i]);
 	}
-	return EOK;
 }
 /*----------------------------------------------------------------------------*/
Index: uspace/drv/uhci-rhd/root_hub.h
===================================================================
--- uspace/drv/uhci-rhd/root_hub.h	(revision ccbcd895e1a6389190a7f195e2e8763c14de33df)
+++ uspace/drv/uhci-rhd/root_hub.h	(revision f9c03b5741ded16234379e99ce809ea66a8b9f6c)
@@ -50,5 +50,5 @@
   uhci_root_hub_t *instance, void *addr, size_t size, ddf_dev_t *rh);
 
-int uhci_root_hub_fini(uhci_root_hub_t *instance);
+void uhci_root_hub_fini(uhci_root_hub_t *instance);
 #endif
 /**
