Index: uspace/drv/bus/usb/ehci/main.c
===================================================================
--- uspace/drv/bus/usb/ehci/main.c	(revision c53007f8f839360255b99edfba5f7a90acf0b96f)
+++ uspace/drv/bus/usb/ehci/main.c	(revision d93098016e1edb95431e7ca5092c5889f70c514a)
@@ -33,8 +33,10 @@
  * Main routines of EHCI driver.
  */
+
 #include <ddf/driver.h>
 #include <ddf/interrupt.h>
 #include <device/hw_res.h>
 #include <errno.h>
+#include <stdbool.h>
 #include <str_error.h>
 
@@ -70,10 +72,8 @@
 static int ehci_dev_add(ddf_dev_t *device)
 {
+	ddf_fun_t *hc_fun = NULL;
+	bool fun_bound = false;
+
 	assert(device);
-#define CHECK_RET_RETURN(ret, message...) \
-if (ret != EOK) { \
-	usb_log_error(message); \
-	return ret; \
-}
 
 	uintptr_t reg_base = 0;
@@ -81,37 +81,54 @@
 	int irq = 0;
 
-	int ret = get_my_registers(device, &reg_base, &reg_size, &irq);
-	CHECK_RET_RETURN(ret,
-	    "Failed to get memory addresses for %" PRIun ": %s.\n",
-	    ddf_dev_get_handle(device), str_error(ret));
+	int rc = get_my_registers(device, &reg_base, &reg_size, &irq);
+	if (rc != EOK) {
+		usb_log_error("Failed to get memory addresses for %" PRIun
+		    ": %s.\n", ddf_dev_get_handle(device), str_error(rc));
+		goto error;
+	}
+
 	usb_log_info("Memory mapped regs at 0x%" PRIxn " (size %zu), IRQ %d.\n",
 	    reg_base, reg_size, irq);
 
-	ret = disable_legacy(device, reg_base, reg_size);
-	CHECK_RET_RETURN(ret,
-	    "Failed to disable legacy USB: %s.\n", str_error(ret));
+	rc = disable_legacy(device, reg_base, reg_size);
+	if (rc != EOK) {
+		usb_log_error("Failed to disable legacy USB: %s.\n",
+		    str_error(rc));
+		goto error;
+	}
 
-	ddf_fun_t *hc_fun = ddf_fun_create(device, fun_exposed, "ehci_hc");
+	hc_fun = ddf_fun_create(device, fun_exposed, "ehci_hc");
 	if (hc_fun == NULL) {
 		usb_log_error("Failed to create EHCI function.\n");
-		return ENOMEM;
+		rc = ENOMEM;
+		goto error;
 	}
+
 	hcd_t *ehci_hc = ddf_fun_data_alloc(hc_fun, sizeof(hcd_t));
 	if (ehci_hc == NULL) {
 		usb_log_error("Failed to alloc generic HC driver.\n");
-		return ENOMEM;
+		rc = ENOMEM;
+		goto error;
 	}
+
 	/* High Speed, no bandwidth */
 	hcd_init(ehci_hc, USB_SPEED_HIGH, 0, NULL);
 	ddf_fun_set_ops(hc_fun,  &hc_ops);
 
-	ret = ddf_fun_bind(hc_fun);
-	CHECK_RET_RETURN(ret,
-	    "Failed to bind EHCI function: %s.\n",
-	    str_error(ret));
-	ret = ddf_fun_add_to_category(hc_fun, USB_HC_CATEGORY);
-	CHECK_RET_RETURN(ret,
-	    "Failed to add EHCI to HC class: %s.\n",
-	    str_error(ret));
+	rc = ddf_fun_bind(hc_fun);
+	if (rc != EOK) {
+		usb_log_error("Failed to bind EHCI function: %s.\n",
+		    str_error(rc));
+		goto error;
+	}
+
+	fun_bound = true;
+
+	rc = ddf_fun_add_to_category(hc_fun, USB_HC_CATEGORY);
+	if (rc != EOK) {
+		usb_log_error("Failed to add EHCI to HC class: %s.\n",
+		    str_error(rc));
+		goto error;
+	}
 
 	usb_log_info("Controlling new EHCI device `%s' (handle %" PRIun ").\n",
@@ -119,5 +136,10 @@
 
 	return EOK;
-#undef CHECK_RET_RETURN
+error:
+	if (fun_bound)
+		ddf_fun_unbind(hc_fun);
+	if (hc_fun != NULL)
+		ddf_fun_destroy(hc_fun);
+	return rc;
 }
 
Index: uspace/drv/bus/usb/ehci/res.c
===================================================================
--- uspace/drv/bus/usb/ehci/res.c	(revision c53007f8f839360255b99edfba5f7a90acf0b96f)
+++ uspace/drv/bus/usb/ehci/res.c	(revision d93098016e1edb95431e7ca5092c5889f70c514a)
@@ -145,17 +145,14 @@
 		return ENOMEM;
 
-#define CHECK_RET_HANGUP_RETURN(ret, message...) \
-	if (ret != EOK) { \
-		usb_log_error(message); \
-		async_hangup(parent_sess); \
-		return ret; \
-	} else (void)0
-
 	/* Read the first EEC. i.e. Legacy Support register */
 	uint32_t usblegsup;
-	int ret = pci_config_space_read_32(parent_sess,
+	int rc = pci_config_space_read_32(parent_sess,
 	    eecp + USBLEGSUP_OFFSET, &usblegsup);
-	CHECK_RET_HANGUP_RETURN(ret,
-	    "Failed to read USBLEGSUP: %s.\n", str_error(ret));
+	if (rc != EOK) {
+		usb_log_error("Failed to read USBLEGSUP: %s.\n",
+		    str_error(rc));
+		goto error;
+	}
+
 	usb_log_debug("USBLEGSUP: %" PRIx32 ".\n", usblegsup);
 
@@ -163,17 +160,31 @@
 	 * byte. (OS Control semaphore)*/
 	usb_log_debug("Requesting OS control.\n");
-	ret = pci_config_space_write_8(parent_sess,
+	rc = pci_config_space_write_8(parent_sess,
 	    eecp + USBLEGSUP_OFFSET + 3, 1);
-	CHECK_RET_HANGUP_RETURN(ret, "Failed to request OS EHCI control: %s.\n",
-	    str_error(ret));
+	if (rc != EOK) {
+		usb_log_error("Failed to request OS EHCI control: %s.\n",
+		    str_error(rc));
+		goto error;
+	}
 
 	size_t wait = 0;
 	/* Wait for BIOS to release control. */
-	ret = pci_config_space_read_32(
+	rc = pci_config_space_read_32(
 	    parent_sess, eecp + USBLEGSUP_OFFSET, &usblegsup);
+	if (rc != EOK) {
+		usb_log_error("Failed reading PCI config space: %s.\n",
+		    str_error(rc));
+		goto error;
+	}
+
 	while ((wait < DEFAULT_WAIT) && (usblegsup & USBLEGSUP_BIOS_CONTROL)) {
 		async_usleep(WAIT_STEP);
-		ret = pci_config_space_read_32(parent_sess,
+		rc = pci_config_space_read_32(parent_sess,
 		    eecp + USBLEGSUP_OFFSET, &usblegsup);
+		if (rc != EOK) {
+			usb_log_error("Failed reading PCI config space: %s.\n",
+			    str_error(rc));
+			goto error;
+		}
 		wait += WAIT_STEP;
 	}
@@ -188,8 +199,12 @@
 	usb_log_warning( "BIOS failed to release control after "
 	    "%zu usecs, force it.\n", wait);
-	ret = pci_config_space_write_32(parent_sess,
+	rc = pci_config_space_write_32(parent_sess,
 	    eecp + USBLEGSUP_OFFSET, USBLEGSUP_OS_CONTROL);
-	CHECK_RET_HANGUP_RETURN(ret, "Failed to force OS control: "
-	    "%s.\n", str_error(ret));
+	if (rc != EOK) {
+		usb_log_error("Failed to force OS control: "
+		    "%s.\n", str_error(rc));
+		goto error;
+	}
+
 	/*
 	 * Check capability type here, value of 01h identifies the capability
@@ -201,8 +216,12 @@
 		/* Read the second EEC Legacy Support and Control register */
 		uint32_t usblegctlsts;
-		ret = pci_config_space_read_32(parent_sess,
+		rc = pci_config_space_read_32(parent_sess,
 		    eecp + USBLEGCTLSTS_OFFSET, &usblegctlsts);
-		CHECK_RET_HANGUP_RETURN(ret, "Failed to get USBLEGCTLSTS: %s.\n",
-		    str_error(ret));
+		if (rc != EOK) {
+			usb_log_error("Failed to get USBLEGCTLSTS: %s.\n",
+			    str_error(rc));
+			goto error;
+		}
+
 		usb_log_debug("USBLEGCTLSTS: %" PRIx32 ".\n", usblegctlsts);
 		/*
@@ -211,12 +230,20 @@
 		 * interfering. NOTE: Three upper bits are WC
 		 */
-		ret = pci_config_space_write_32(parent_sess,
+		rc = pci_config_space_write_32(parent_sess,
 		    eecp + USBLEGCTLSTS_OFFSET, 0xe0000000);
-		CHECK_RET_HANGUP_RETURN(ret, "Failed(%d) zero USBLEGCTLSTS.\n", ret);
+		if (rc != EOK) {
+			usb_log_error("Failed(%d) zero USBLEGCTLSTS.\n", rc);
+			goto error;
+		}
+
 		udelay(10);
-		ret = pci_config_space_read_32(parent_sess,
+		rc = pci_config_space_read_32(parent_sess,
 		    eecp + USBLEGCTLSTS_OFFSET, &usblegctlsts);
-		CHECK_RET_HANGUP_RETURN(ret, "Failed to get USBLEGCTLSTS 2: %s.\n",
-		    str_error(ret));
+		if (rc != EOK) {
+			usb_log_error("Failed to get USBLEGCTLSTS 2: %s.\n",
+			    str_error(rc));
+			goto error;
+		}
+
 		usb_log_debug("Zeroed USBLEGCTLSTS: %" PRIx32 ".\n",
 		    usblegctlsts);
@@ -224,12 +251,18 @@
 
 	/* Read again Legacy Support register */
-	ret = pci_config_space_read_32(parent_sess,
+	rc = pci_config_space_read_32(parent_sess,
 	    eecp + USBLEGSUP_OFFSET, &usblegsup);
-	CHECK_RET_HANGUP_RETURN(ret, "Failed to read USBLEGSUP: %s.\n",
-	    str_error(ret));
+	if (rc != EOK) {
+		usb_log_error("Failed to read USBLEGSUP: %s.\n",
+		    str_error(rc));
+		goto error;
+	}
+
 	usb_log_debug("USBLEGSUP: %" PRIx32 ".\n", usblegsup);
 	async_hangup(parent_sess);
 	return EOK;
-#undef CHECK_RET_HANGUP_RETURN
+error:
+	async_hangup(parent_sess);
+	return rc;
 }
 
@@ -239,15 +272,12 @@
 	usb_log_debug("Disabling EHCI legacy support.\n");
 
-#define CHECK_RET_RETURN(ret, message...) \
-	if (ret != EOK) { \
-		usb_log_error(message); \
-		return ret; \
-	} else (void)0
-
 	/* Map EHCI registers */
 	void *regs = NULL;
-	int ret = pio_enable((void*)reg_base, reg_size, &regs);
-	CHECK_RET_RETURN(ret, "Failed to map registers %p: %s.\n",
-	    (void *) reg_base, str_error(ret));
+	int rc = pio_enable((void*)reg_base, reg_size, &regs);
+	if (rc != EOK) {
+		usb_log_error("Failed to map registers %p: %s.\n",
+		    (void *) reg_base, str_error(rc));
+		return rc;
+	}
 
 	usb_log_debug2("Registers mapped at: %p.\n", regs);
@@ -263,9 +293,10 @@
 	usb_log_debug("Value of EECP: %x.\n", eecp);
 
-	ret = disable_extended_caps(device, eecp);
-	CHECK_RET_RETURN(ret, "Failed to disable extended capabilities: %s.\n",
-	    str_error(ret));
-
-#undef CHECK_RET_RETURN
+	rc = disable_extended_caps(device, eecp);
+	if (rc != EOK) {
+		usb_log_error("Failed to disable extended capabilities: %s.\n",
+		    str_error(rc));
+		return rc;
+	}
 
 	/*
@@ -306,5 +337,5 @@
 	    usbcmd, *usbcmd, usbsts, *usbsts, usbint, *usbint, usbconf,*usbconf);
 
-	return ret;
+	return rc;
 }
 
Index: uspace/drv/bus/usb/uhci/hc.c
===================================================================
--- uspace/drv/bus/usb/uhci/hc.c	(revision c53007f8f839360255b99edfba5f7a90acf0b96f)
+++ uspace/drv/bus/usb/uhci/hc.c	(revision d93098016e1edb95431e7ca5092c5889f70c514a)
@@ -430,5 +430,4 @@
 
 	return EOK;
-#undef CHECK_RET_CLEAR_RETURN
 }
 
