Index: uspace/lib/usbhost/src/bus.c
===================================================================
--- uspace/lib/usbhost/src/bus.c	(revision 9df0f64255a1e09efd87f6b2371e99e87f9e8350)
+++ uspace/lib/usbhost/src/bus.c	(revision f4f4b95e62a33cdf2a50bf7841b07ccb8ade8dff)
@@ -370,5 +370,5 @@
 int bus_endpoint_add(device_t *device, const usb_endpoint_descriptors_t *desc, endpoint_t **out_ep)
 {
-	int err;
+	int err = EINVAL;
 	assert(device);
 
@@ -392,7 +392,4 @@
 	assert((ep->required_transfer_buffer_policy & ~ep->transfer_buffer_policy) == 0);
 
-	/* Bus reference */
-	endpoint_add_ref(ep);
-
 	const size_t idx = bus_endpoint_index(ep->endpoint, ep->direction);
 	if (idx >= ARRAY_SIZE(device->endpoints)) {
@@ -425,8 +422,6 @@
 	}
 	fibril_mutex_unlock(&device->guard);
-	if (err) {
-		endpoint_del_ref(ep);
-		return err;
-	}
+	if (err)
+		goto drop;
 
 	if (out_ep) {
@@ -438,7 +433,6 @@
 	return EOK;
 drop:
-	/* Bus reference */
 	endpoint_del_ref(ep);
-	return EINVAL;
+	return err;
 }
 
