Index: uspace/lib/usbhost/src/usb_endpoint_manager.c
===================================================================
--- uspace/lib/usbhost/src/usb_endpoint_manager.c	(revision 3e6a98c595287c43d200d28d97f57755342be117)
+++ uspace/lib/usbhost/src/usb_endpoint_manager.c	(revision 65f77f49a836dcced483f55fa0160a30f7948d1e)
@@ -90,6 +90,5 @@
 	if (address < 0)
 		return NULL;
-	list_foreach(*get_list(instance, address), iterator) {
-		endpoint_t *ep = endpoint_get_instance(iterator);
+	list_foreach(*get_list(instance, address), link, endpoint_t, ep) {
 		if (ep_match(ep, address, endpoint, direction))
 			return ep;
@@ -196,6 +195,6 @@
 			fibril_mutex_lock(&instance->guard);
 			/* endpoint number is < 16, thus first byte is enough */
-			list_foreach(*get_list(instance, target.address), it) {
-				endpoint_t *ep = endpoint_get_instance(it);
+			list_foreach(*get_list(instance, target.address),
+			    link, endpoint_t, ep) {
 				if ((ep->address == target.address)
 				    && (ep->endpoint = data[4])) {
@@ -216,6 +215,6 @@
 		if ((data[0] & 0xf) == 0) {
 			fibril_mutex_lock(&instance->guard);
-			list_foreach(*get_list(instance, target.address), it) {
-				endpoint_t *ep = endpoint_get_instance(it);
+			list_foreach(*get_list(instance, target.address),
+			    link, endpoint_t, ep) {
 				if (ep->address == target.address) {
 					endpoint_toggle_set(ep,0);
@@ -408,11 +407,19 @@
     usb_address_t address, void (*callback)(endpoint_t *, void *), void *arg)
 {
+	list_t *list;
+	link_t *link;
+	link_t *next;
+
 	assert(address >= 0);
 	assert(instance);
 	fibril_mutex_lock(&instance->guard);
-	list_foreach(*get_list(instance, address), iterator) {
-		endpoint_t *ep = endpoint_get_instance(iterator);
+
+	list = get_list(instance, address);
+	link = list_first(list);
+	while (link != NULL) {
+		endpoint_t *ep = list_get_instance(link, endpoint_t, link);
+		next = list_next(link, list);
+
 		if (ep->address == address) {
-			iterator = iterator->next;
 			list_remove(&ep->link);
 			if (callback)
@@ -420,4 +427,5 @@
 			endpoint_destroy(ep);
 		}
+		link = next;
 	}
 	fibril_mutex_unlock(&instance->guard);
