Index: uspace/drv/bus/usb/usbhub/usbhub.c
===================================================================
--- uspace/drv/bus/usb/usbhub/usbhub.c	(revision ee9ea160ea1ceb3f62e5c5e92edbedc9ec7200eb)
+++ uspace/drv/bus/usb/usbhub/usbhub.c	(revision d46b13dac28efb442c0b90728472392b4e445803)
@@ -55,9 +55,9 @@
 #include <usb/classes/classes.h>
 
+#define HUB_FNC_NAME "hub"
 
 static usb_hub_info_t * usb_hub_info_create(usb_device_t *usb_dev);
 static int usb_hub_process_hub_specific_info(usb_hub_info_t *hub_info);
 static int usb_hub_set_configuration(usb_hub_info_t *hub_info);
-static int usb_hub_start_hub_fibril(usb_hub_info_t *hub_info);
 static int usb_process_hub_over_current(usb_hub_info_t *hub_info,
     usb_hub_status_t status);
@@ -83,5 +83,6 @@
  * @return error code
  */
-int usb_hub_add_device(usb_device_t *usb_dev) {
+int usb_hub_add_device(usb_device_t *usb_dev)
+{
 	if (!usb_dev) return EINVAL;
 	usb_hub_info_t *hub_info = usb_hub_info_create(usb_dev);
@@ -106,4 +107,5 @@
 		return opResult;
 	}
+
 	//get port count and create attached_devs
 	opResult = usb_hub_process_hub_specific_info(hub_info);
@@ -115,17 +117,36 @@
 	}
 
-	usb_log_debug("Creating 'hub' function in DDF.\n");
+	usb_log_debug("Creating DDF function '" HUB_FNC_NAME "'.\n");
 	ddf_fun_t *hub_fun = ddf_fun_create(hub_info->usb_device->ddf_dev,
-	    fun_exposed, "hub");
-	assert(hub_fun != NULL);
-	hub_fun->ops = NULL;
+	    fun_exposed, HUB_FNC_NAME);
+	if (hub_fun == NULL) {
+		usb_log_error("Failed to create hub function.\n");
+		free(hub_info);
+		return ENOMEM;
+	}
 
 	opResult = ddf_fun_bind(hub_fun);
-	assert(opResult == EOK);
-
-	opResult = usb_hub_start_hub_fibril(hub_info);
-	if (opResult != EOK)
+	if (opResult != EOK) {
+		usb_log_error("Failed to bind hub function: %s.\n",
+		   str_error(opResult));
 		free(hub_info);
-	return opResult;
+		ddf_fun_destroy(hub_fun);
+		return opResult;
+	}
+
+	opResult = usb_device_auto_poll(hub_info->usb_device, 0,
+	    hub_port_changes_callback, ((hub_info->port_count + 1) / 8) + 1,
+	    usb_hub_polling_terminated_callback, hub_info);
+	if (opResult != EOK) {
+		ddf_fun_destroy(hub_fun);
+		free(hub_info);
+		usb_log_error("Failed to create polling fibril: %s.\n",
+		    str_error(opResult));
+		return opResult;
+	}
+	usb_log_info("Controlling hub '%s' (%zu ports).\n",
+	    hub_info->usb_device->ddf_dev->name, hub_info->port_count);
+
+	return EOK;
 }
 
@@ -322,31 +343,4 @@
 	    config_descriptor->configuration_number);
 
-	return EOK;
-}
-
-/**
- * create and start fibril with hub control loop
- *
- * Before the fibril is started, the control pipe and host controller
- * connection of the hub is open.
- *
- * @param hub_info hub representing structure
- * @return error code
- */
-static int usb_hub_start_hub_fibril(usb_hub_info_t *hub_info) {
-	int rc;
-
-	rc = usb_device_auto_poll(hub_info->usb_device, 0,
-	    hub_port_changes_callback, ((hub_info->port_count + 1) / 8) + 1,
-	    usb_hub_polling_terminated_callback, hub_info);
-	if (rc != EOK) {
-		usb_log_error("Failed to create polling fibril: %s.\n",
-		    str_error(rc));
-		free(hub_info);
-		return rc;
-	}
-
-	usb_log_info("Controlling hub `%s' (%zu ports).\n",
-	    hub_info->usb_device->ddf_dev->name, hub_info->port_count);
 	return EOK;
 }
