Index: uspace/drv/usbhub/main.c
===================================================================
--- uspace/drv/usbhub/main.c	(revision 74f00b6d84025d10f2385366580496754f90b606)
+++ uspace/drv/usbhub/main.c	(revision 361fcec468eeecd07b777f8b9ccd24b9e7edf14d)
@@ -55,9 +55,16 @@
 };
 
-
+/**
+ * usb hub driver operations
+ *
+ * The most important one is add_device, which is set to usb_hub_add_device.
+ */
 static usb_driver_ops_t usb_hub_driver_ops = {
 	.add_device = usb_hub_add_device
 };
 
+/**
+ * hub endpoints, excluding control endpoint
+ */
 static usb_endpoint_description_t *usb_hub_endpoints[] = {
 	&hub_status_change_endpoint_description,
@@ -65,4 +72,7 @@
 };
 
+/**
+ * static usb hub driver information
+ */
 static usb_driver_t usb_hub_driver = {
 	.name = NAME,
Index: uspace/drv/usbhub/ports.c
===================================================================
--- uspace/drv/usbhub/ports.c	(revision 74f00b6d84025d10f2385366580496754f90b606)
+++ uspace/drv/usbhub/ports.c	(revision 361fcec468eeecd07b777f8b9ccd24b9e7edf14d)
@@ -167,5 +167,4 @@
 
 	//close address
-	//if (hub->attached_devs[port].address != 0) {
 	if(hub->ports[port].attached_device.address >= 0){
 		/*uncomment this code to use it when DDF allows device removal
@@ -182,5 +181,4 @@
 		 */
 	} else {
-		// TODO: is this really reason to print a warning?
 		usb_log_warning("Device removed before being registered.\n");
 
Index: uspace/drv/usbhub/usbhub.c
===================================================================
--- uspace/drv/usbhub/usbhub.c	(revision 74f00b6d84025d10f2385366580496754f90b606)
+++ uspace/drv/usbhub/usbhub.c	(revision 361fcec468eeecd07b777f8b9ccd24b9e7edf14d)
@@ -73,6 +73,4 @@
 
 
-/// \TODO malloc checking
-
 //*********************************************
 //
@@ -248,4 +246,7 @@
 	hub_info->ports = malloc(
 	    sizeof (usb_hub_port_t) * (hub_info->port_count + 1));
+	if(!hub_info->ports){
+		return ENOMEM;
+	}
 	size_t port;
 	for (port = 0; port < hub_info->port_count + 1; ++port) {
@@ -255,4 +256,14 @@
 		usb_log_debug("is_power_switched\n");
 		
+		if(!has_individual_port_powering){
+			usb_log_debug("!has_individual_port_powering\n");
+			opResult = usb_hub_set_feature(hub_info->control_pipe,
+			    USB_HUB_FEATURE_C_HUB_LOCAL_POWER);
+			if (opResult != EOK) {
+				usb_log_error("cannot power hub: %s\n",
+				    str_error(opResult));
+			}
+		}
+
 		for (port = 1; port <= hub_info->port_count; ++port) {
 			usb_log_debug("Powering port %zu.\n",port);
@@ -264,15 +275,7 @@
 			}
 		}
-		if(!has_individual_port_powering){
-			usb_log_debug("!has_individual_port_powering\n");
-			opResult = usb_hub_set_feature(hub_info->control_pipe,
-			    USB_HUB_FEATURE_C_HUB_LOCAL_POWER);
-			if (opResult != EOK) {
-				usb_log_error("cannot power hub: %s\n",
-				    str_error(opResult));
-			}
-		}
+		
 	}else{
-		usb_log_debug("!is_power_switched\n");
+		usb_log_debug("!is_power_switched, not going to be powered\n");
 	}
 	usb_log_debug2("freeing data\n");
