Index: uspace/lib/usb/src/devdrv.c
===================================================================
--- uspace/lib/usb/src/devdrv.c	(revision 231748a618fbdcceb0d9ced35cae7e83a5f17375)
+++ uspace/lib/usb/src/devdrv.c	(revision 3f2af64e65d6dad203aa878c7a1370a40e2124b5)
@@ -180,4 +180,11 @@
  * with usb_pipe_initialize_from_configuration().
  *
+ * @warning This is a wrapper function that does several operations that
+ * can fail and that cannot be rollbacked easily. That means that a failure
+ * during the SET_INTERFACE request would result in having a device with
+ * no pipes at all (except the default control one). That is because the old
+ * pipes needs to be unregistered at HC first and the new ones could not
+ * be created.
+ *
  * @param dev USB device.
  * @param alternate_setting Alternate setting to choose.
@@ -193,6 +200,4 @@
 
 	int rc;
-
-	/* TODO: more transactional behavior. */
 
 	/* Destroy existing pipes. */
@@ -431,7 +436,11 @@
 }
 
-/** Initialize control pipe and device descriptors. */
-static int initialize_ctrl_pipe_and_descriptors(usb_device_t *dev,
-     const char **errmsg)
+/** Initialize control pipe in a device.
+ *
+ * @param dev USB device in question.
+ * @param errmsg Where to store error context.
+ * @return
+ */
+static int init_wire_and_ctrl_pipe(usb_device_t *dev, const char **errmsg)
 {
 	int rc;
@@ -451,15 +460,5 @@
 	}
 
-	/* Get our interface. */
-	dev->interface_no = usb_device_get_assigned_interface(dev->ddf_dev);
-
-	/* Retrieve the descriptors. */
-	rc = usb_device_retrieve_descriptors(&dev->ctrl_pipe,
-	    &dev->descriptors);
-	if (rc != EOK) {
-		*errmsg = "descriptor retrieval";
-	}
-
-	return rc;
+	return EOK;
 }
 
@@ -489,4 +488,6 @@
 	}
 
+	// FIXME: proper deallocation in case of errors
+
 	dev->ddf_dev = ddf_dev;
 	dev->driver_data = NULL;
@@ -497,9 +498,22 @@
 	dev->pipes = NULL;
 
-	rc = initialize_ctrl_pipe_and_descriptors(dev, errstr_ptr);
-	if (rc != EOK) {
-		return rc;
-	}
-
+	/* Initialize backing wire and control pipe. */
+	rc = init_wire_and_ctrl_pipe(dev, errstr_ptr);
+	if (rc != EOK) {
+		return rc;
+	}
+
+	/* Get our interface. */
+	dev->interface_no = usb_device_get_assigned_interface(dev->ddf_dev);
+
+	/* Retrieve standard descriptors. */
+	rc = usb_device_retrieve_descriptors(&dev->ctrl_pipe,
+	    &dev->descriptors);
+	if (rc != EOK) {
+		*errstr_ptr = "descriptor retrieval";
+		return rc;
+	}
+
+	/* Create alternate interfaces. */
 	rc = usb_alternate_interfaces_create(dev->descriptors.configuration,
 	    dev->descriptors.configuration_size, dev->interface_no,
@@ -513,5 +527,4 @@
 	if (rc != EOK) {
 		*errstr_ptr = "pipes initialization";
-		/* TODO: deallocate */
 		return rc;
 	}
