Index: uspace/drv/bus/usb/ohci/hc.c
===================================================================
--- uspace/drv/bus/usb/ohci/hc.c	(revision 507c6f349a523ca47c817c9159f5dc1e3c60fb57)
+++ uspace/drv/bus/usb/ohci/hc.c	(revision f83666c85c38a93847c830fe6af1660249d56919)
@@ -35,4 +35,5 @@
 
 #include <errno.h>
+#include <stdbool.h>
 #include <str_error.h>
 #include <adt/list.h>
@@ -183,4 +184,9 @@
 int hc_register_hub(hc_t *instance, ddf_fun_t *hub_fun)
 {
+	bool addr_reqd = false;
+	bool ep_added = false;
+	bool fun_bound = false;
+	int rc;
+
 	assert(instance);
 	assert(hub_fun);
@@ -188,48 +194,64 @@
 	/* Try to get address 1 for root hub. */
 	instance->rh.address = 1;
-	int ret = usb_device_manager_request_address(
+	rc = usb_device_manager_request_address(
 	    &instance->generic.dev_manager, &instance->rh.address, false,
 	    USB_SPEED_FULL);
-	if (ret != EOK) {
+	if (rc != EOK) {
 		usb_log_error("Failed to get OHCI root hub address: %s\n",
-		    str_error(ret));
-		return ret;
-	}
-
-#define CHECK_RET_UNREG_RETURN(ret, message...) \
-if (ret != EOK) { \
-	usb_log_error(message); \
-	usb_endpoint_manager_remove_ep( \
-	    &instance->generic.ep_manager, instance->rh.address, 0, \
-	    USB_DIRECTION_BOTH, NULL, NULL); \
-	usb_device_manager_release_address( \
-	    &instance->generic.dev_manager, instance->rh.address); \
-	return ret; \
-} else (void)0
-
-	ret = usb_endpoint_manager_add_ep(
+		    str_error(rc));
+		goto error;
+	}
+
+	addr_reqd = true;
+
+	rc = usb_endpoint_manager_add_ep(
 	    &instance->generic.ep_manager, instance->rh.address, 0,
 	    USB_DIRECTION_BOTH, USB_TRANSFER_CONTROL, USB_SPEED_FULL, 64,
 	    0, NULL, NULL);
-	CHECK_RET_UNREG_RETURN(ret,
-	    "Failed to register root hub control endpoint: %s.\n",
-	    str_error(ret));
-
-	ret = ddf_fun_add_match_id(hub_fun, "usb&class=hub", 100);
-	CHECK_RET_UNREG_RETURN(ret,
-	    "Failed to add root hub match-id: %s.\n", str_error(ret));
-
-	ret = ddf_fun_bind(hub_fun);
-	CHECK_RET_UNREG_RETURN(ret,
-	    "Failed to bind root hub function: %s.\n", str_error(ret));
-
-	ret = usb_device_manager_bind_address(&instance->generic.dev_manager,
+	if (rc != EOK) {
+    	        usb_log_error("Failed to register root hub control endpoint: %s.\n",
+		    str_error(rc));
+		goto error;
+	}
+
+	ep_added = true;
+
+	rc = ddf_fun_add_match_id(hub_fun, "usb&class=hub", 100);
+	if (rc != EOK) {
+		usb_log_error("Failed to add root hub match-id: %s.\n",
+		    str_error(rc));
+		goto error;
+	}
+
+	rc = ddf_fun_bind(hub_fun);
+	if (rc != EOK) {
+		usb_log_error("Failed to bind root hub function: %s.\n",
+		    str_error(rc));
+		goto error;
+	}
+
+	fun_bound = true;
+
+	rc = usb_device_manager_bind_address(&instance->generic.dev_manager,
 	    instance->rh.address, ddf_fun_get_handle(hub_fun));
-	if (ret != EOK)
+	if (rc != EOK) {
 		usb_log_warning("Failed to bind root hub address: %s.\n",
-		    str_error(ret));
-
-	return EOK;
-#undef CHECK_RET_RELEASE
+		    str_error(rc));
+	}
+
+	return EOK;
+error:
+	if (fun_bound)
+		ddf_fun_unbind(hub_fun);
+	if (ep_added) {
+		usb_endpoint_manager_remove_ep(
+		    &instance->generic.ep_manager, instance->rh.address, 0,
+		    USB_DIRECTION_BOTH, NULL, NULL);
+	}
+	if (addr_reqd) {
+		usb_device_manager_release_address(
+		    &instance->generic.dev_manager, instance->rh.address);
+	}
+	return rc;
 }
 
@@ -246,14 +268,11 @@
 	assert(instance);
 
-#define CHECK_RET_RETURN(ret, message...) \
-if (ret != EOK) { \
-	usb_log_error(message); \
-	return ret; \
-} else (void)0
-
-	int ret =
+	int rc =
 	    pio_enable((void*)regs, reg_size, (void**)&instance->registers);
-	CHECK_RET_RETURN(ret,
-	    "Failed to gain access to device registers: %s.\n", str_error(ret));
+	if (rc != EOK) {
+		usb_log_error("Failed to gain access to device registers: %s.\n",
+		    str_error(rc));
+		return rc;
+	}
 
 	list_initialize(&instance->pending_batches);
@@ -266,8 +285,10 @@
 	instance->generic.ep_remove_hook = ohci_endpoint_fini;
 
-	ret = hc_init_memory(instance);
-	CHECK_RET_RETURN(ret, "Failed to create OHCI memory structures: %s.\n",
-	    str_error(ret));
-#undef CHECK_RET_RETURN
+	rc = hc_init_memory(instance);
+	if (rc != EOK) {
+		usb_log_error("Failed to create OHCI memory structures: %s.\n",
+		    str_error(rc));
+		return rc;
+	}
 
 	fibril_mutex_initialize(&instance->guard);
