Index: uspace/drv/bus/usb/xhci/bus.c
===================================================================
--- uspace/drv/bus/usb/xhci/bus.c	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/bus.c	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -68,5 +68,5 @@
  * @return Error code.
  */
-int xhci_bus_init(xhci_bus_t *bus, xhci_hc_t *hc)
+errno_t xhci_bus_init(xhci_bus_t *bus, xhci_hc_t *hc)
 {
 	assert(bus);
Index: uspace/drv/bus/usb/xhci/bus.h
===================================================================
--- uspace/drv/bus/usb/xhci/bus.h	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/bus.h	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -52,5 +52,5 @@
 } xhci_bus_t;
 
-extern int xhci_bus_init(xhci_bus_t *, xhci_hc_t *);
+extern errno_t xhci_bus_init(xhci_bus_t *, xhci_hc_t *);
 extern void xhci_bus_fini(xhci_bus_t *);
 
Index: uspace/drv/bus/usb/xhci/commands.c
===================================================================
--- uspace/drv/bus/usb/xhci/commands.c	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/commands.c	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -72,8 +72,8 @@
  * reset before starting.
  */
-int xhci_init_commands(xhci_hc_t *hc)
+errno_t xhci_init_commands(xhci_hc_t *hc)
 {
 	xhci_cmd_ring_t *cr = get_cmd_ring(hc);
-	int err;
+	errno_t err;
 
 	if ((err = xhci_trb_ring_init(&cr->trb_ring, 0)))
@@ -172,5 +172,5 @@
 }
 
-static int wait_for_ring_open(xhci_cmd_ring_t *cr)
+static errno_t wait_for_ring_open(xhci_cmd_ring_t *cr)
 {
 	assert(fibril_mutex_is_locked(&cr->guard));
@@ -194,5 +194,5 @@
  * Register the command as waiting for completion inside the command list.
  */
-static inline int enqueue_command(xhci_hc_t *hc, xhci_cmd_t *cmd)
+static inline errno_t enqueue_command(xhci_hc_t *hc, xhci_cmd_t *cmd)
 {
 	xhci_cmd_ring_t *cr = get_cmd_ring(hc);
@@ -210,5 +210,5 @@
 	list_append(&cmd->_header.link, &cr->cmd_list);
 
-	int err = EOK;
+	errno_t err = EOK;
 	while (err == EOK) {
 		err = xhci_trb_ring_enqueue(&cr->trb_ring,
@@ -343,5 +343,5 @@
  * @param trb The COMMAND_COMPLETION TRB found in event ring.
  */
-int xhci_handle_command_completion(xhci_hc_t *hc, xhci_trb_t *trb)
+errno_t xhci_handle_command_completion(xhci_hc_t *hc, xhci_trb_t *trb)
 {
 	xhci_cmd_ring_t *cr = get_cmd_ring(hc);
@@ -416,5 +416,5 @@
 /* Command-issuing functions */
 
-static int no_op_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
+static errno_t no_op_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
 {
 	assert(hc);
@@ -427,5 +427,5 @@
 }
 
-static int enable_slot_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
+static errno_t enable_slot_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
 {
 	assert(hc);
@@ -440,5 +440,5 @@
 }
 
-static int disable_slot_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
+static errno_t disable_slot_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
 {
 	assert(hc);
@@ -453,5 +453,5 @@
 }
 
-static int address_device_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
+static errno_t address_device_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
 {
 	assert(hc);
@@ -483,5 +483,5 @@
 }
 
-static int configure_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
+static errno_t configure_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
 {
 	assert(hc);
@@ -504,5 +504,5 @@
 }
 
-static int evaluate_context_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
+static errno_t evaluate_context_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
 {
 	assert(hc);
@@ -526,5 +526,5 @@
 }
 
-static int reset_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
+static errno_t reset_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
 {
 	assert(hc);
@@ -541,5 +541,5 @@
 }
 
-static int stop_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
+static errno_t stop_endpoint_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
 {
 	assert(hc);
@@ -556,5 +556,5 @@
 }
 
-static int set_tr_dequeue_pointer_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
+static errno_t set_tr_dequeue_pointer_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
 {
 	assert(hc);
@@ -572,5 +572,5 @@
 }
 
-static int reset_device_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
+static errno_t reset_device_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
 {
 	assert(hc);
@@ -585,5 +585,5 @@
 }
 
-static int get_port_bandwidth_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
+static errno_t get_port_bandwidth_cmd(xhci_hc_t *hc, xhci_cmd_t *cmd)
 {
 	assert(hc);
@@ -603,5 +603,5 @@
 /* The table of command-issuing functions. */
 
-typedef int (*cmd_handler) (xhci_hc_t *hc, xhci_cmd_t *cmd);
+typedef errno_t (*cmd_handler) (xhci_hc_t *hc, xhci_cmd_t *cmd);
 
 static cmd_handler cmd_handlers [] = {
@@ -635,5 +635,5 @@
  * COMMAND_ABORTED event.
  */
-static int try_abort_current_command(xhci_hc_t *hc)
+static errno_t try_abort_current_command(xhci_hc_t *hc)
 {
 	xhci_cmd_ring_t *cr = get_cmd_ring(hc);
@@ -694,7 +694,7 @@
  * until COMMAND_COMPLETION event arrives.
  */
-static int wait_for_cmd_completion(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	int rv = EOK;
+static errno_t wait_for_cmd_completion(xhci_hc_t *hc, xhci_cmd_t *cmd)
+{
+	errno_t rv = EOK;
 
 	if (fibril_get_id() == hc->event_handler) {
@@ -731,10 +731,10 @@
  * expires. Nothing is deallocated. Caller should always execute `xhci_cmd_fini`.
  */
-int xhci_cmd_sync(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	assert(hc);
-	assert(cmd);
-
-	int err;
+errno_t xhci_cmd_sync(xhci_hc_t *hc, xhci_cmd_t *cmd)
+{
+	assert(hc);
+	assert(cmd);
+
+	errno_t err;
 
 	if (!cmd_handlers[cmd->_header.cmd]) {
@@ -773,7 +773,7 @@
  * is a useful shorthand for issuing commands without out parameters.
  */
-int xhci_cmd_sync_fini(xhci_hc_t *hc, xhci_cmd_t *cmd)
-{
-	const int err = xhci_cmd_sync(hc, cmd);
+errno_t xhci_cmd_sync_fini(xhci_hc_t *hc, xhci_cmd_t *cmd)
+{
+	const errno_t err = xhci_cmd_sync(hc, cmd);
 	xhci_cmd_fini(cmd);
 
@@ -785,5 +785,5 @@
  * fibril. The command is copied to stack memory and `fini` is called upon its completion.
  */
-int xhci_cmd_async_fini(xhci_hc_t *hc, xhci_cmd_t *stack_cmd)
+errno_t xhci_cmd_async_fini(xhci_hc_t *hc, xhci_cmd_t *stack_cmd)
 {
 	assert(hc);
@@ -801,5 +801,5 @@
 
 	/* Issue the command. */
-	int err;
+	errno_t err;
 
 	if (!cmd_handlers[heap_cmd->_header.cmd]) {
Index: uspace/drv/bus/usb/xhci/commands.h
===================================================================
--- uspace/drv/bus/usb/xhci/commands.h	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/commands.h	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -125,5 +125,5 @@
 
 /* Command handling control */
-extern int xhci_init_commands(xhci_hc_t *);
+extern errno_t xhci_init_commands(xhci_hc_t *);
 extern void xhci_fini_commands(xhci_hc_t *);
 
@@ -133,5 +133,5 @@
 extern void xhci_start_command_ring(xhci_hc_t *);
 
-extern int xhci_handle_command_completion(xhci_hc_t *, xhci_trb_t *);
+extern errno_t xhci_handle_command_completion(xhci_hc_t *, xhci_trb_t *);
 
 /* Command lifecycle */
@@ -140,9 +140,9 @@
 
 /* Issuing commands */
-extern int xhci_cmd_sync(xhci_hc_t *, xhci_cmd_t *);
-extern int xhci_cmd_sync_fini(xhci_hc_t *, xhci_cmd_t *);
-extern int xhci_cmd_async_fini(xhci_hc_t *, xhci_cmd_t *);
+extern errno_t xhci_cmd_sync(xhci_hc_t *, xhci_cmd_t *);
+extern errno_t xhci_cmd_sync_fini(xhci_hc_t *, xhci_cmd_t *);
+extern errno_t xhci_cmd_async_fini(xhci_hc_t *, xhci_cmd_t *);
 
-static inline int xhci_cmd_sync_inline_wrapper(xhci_hc_t *hc, xhci_cmd_t cmd)
+static inline errno_t xhci_cmd_sync_inline_wrapper(xhci_hc_t *hc, xhci_cmd_t cmd)
 {
 	/* Poor man's xhci_cmd_init (everything else is zeroed) */
@@ -152,5 +152,5 @@
 
 	/* Issue the command */
-	const int err = xhci_cmd_sync(hc, &cmd);
+	const errno_t err = xhci_cmd_sync(hc, &cmd);
 	xhci_cmd_fini(&cmd);
 
@@ -166,5 +166,5 @@
  *
  *  Example:
- *    int err = xhci_cmd_sync_inline(hc, DISABLE_SLOT, .slot_id = 42);
+ *    errno_t err = xhci_cmd_sync_inline(hc, DISABLE_SLOT, .slot_id = 42);
  */
 
Index: uspace/drv/bus/usb/xhci/device.c
===================================================================
--- uspace/drv/bus/usb/xhci/device.c	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/device.c	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -72,7 +72,7 @@
  * @return Error code.
  */
-static int address_device(xhci_device_t *dev)
-{
-	int err;
+static errno_t address_device(xhci_device_t *dev)
+{
+	errno_t err;
 
 	/* Enable new slot. */
@@ -115,7 +115,7 @@
  * @return Error code.
  */
-static int setup_ep0_packet_size(xhci_hc_t *hc, xhci_device_t *dev)
-{
-	int err;
+static errno_t setup_ep0_packet_size(xhci_hc_t *hc, xhci_device_t *dev)
+{
+	errno_t err;
 
 	uint16_t max_packet_size;
@@ -144,5 +144,5 @@
  * Just the TT will not work correctly.
  */
-static int setup_hub(xhci_device_t *dev, usb_standard_device_descriptor_t *desc)
+static errno_t setup_hub(xhci_device_t *dev, usb_standard_device_descriptor_t *desc)
 {
 	if (desc->device_class != USB_CLASS_HUB)
@@ -150,5 +150,5 @@
 
 	usb_hub_descriptor_header_t hub_desc = { 0 };
-	const int err = hc_get_hub_desc(&dev->base, &hub_desc);
+	const errno_t err = hc_get_hub_desc(&dev->base, &hub_desc);
 	if (err)
 		return err;
@@ -177,7 +177,7 @@
  * @return Error code.
  */
-int xhci_device_enumerate(device_t *dev)
-{
-	int err;
+errno_t xhci_device_enumerate(device_t *dev)
+{
+	errno_t err;
 	xhci_bus_t *bus = bus_to_xhci_bus(dev->bus);
 	xhci_device_t *xhci_dev = xhci_device_get(dev);
@@ -258,5 +258,5 @@
 void xhci_device_gone(device_t *dev)
 {
-	int err;
+	errno_t err;
 	xhci_bus_t *bus = bus_to_xhci_bus(dev->bus);
 	xhci_device_t *xhci_dev = xhci_device_get(dev);
@@ -277,7 +277,7 @@
  * Bus callback.
  */
-int xhci_device_online(device_t *dev_base)
-{
-	int err;
+errno_t xhci_device_online(device_t *dev_base)
+{
+	errno_t err;
 
 	xhci_bus_t *bus = bus_to_xhci_bus(dev_base->bus);
@@ -305,5 +305,5 @@
 void xhci_device_offline(device_t *dev_base)
 {
-	int err;
+	errno_t err;
 
 	xhci_bus_t *bus = bus_to_xhci_bus(dev_base->bus);
Index: uspace/drv/bus/usb/xhci/device.h
===================================================================
--- uspace/drv/bus/usb/xhci/device.h	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/device.h	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -65,7 +65,7 @@
 
 /* Bus callbacks */
-int xhci_device_enumerate(device_t *);
+errno_t xhci_device_enumerate(device_t *);
 void xhci_device_offline(device_t *);
-int xhci_device_online(device_t *);
+errno_t xhci_device_online(device_t *);
 void xhci_device_gone(device_t *);
 
Index: uspace/drv/bus/usb/xhci/endpoint.c
===================================================================
--- uspace/drv/bus/usb/xhci/endpoint.c	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/endpoint.c	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -48,5 +48,5 @@
 #include "streams.h"
 
-static int alloc_transfer_ds(xhci_endpoint_t *);
+static errno_t alloc_transfer_ds(xhci_endpoint_t *);
 
 /**
@@ -58,8 +58,8 @@
  * @return Error code.
  */
-static int xhci_endpoint_init(xhci_endpoint_t *xhci_ep, device_t *dev,
+static errno_t xhci_endpoint_init(xhci_endpoint_t *xhci_ep, device_t *dev,
     const usb_endpoint_descriptors_t *desc)
 {
-	int rc;
+	errno_t rc;
 	assert(xhci_ep);
 
@@ -180,7 +180,7 @@
  * Bus callback.
  */
-int xhci_endpoint_register(endpoint_t *ep_base)
-{
-	int err;
+errno_t xhci_endpoint_register(endpoint_t *ep_base)
+{
+	errno_t err;
 	xhci_endpoint_t *ep = xhci_endpoint_get(ep_base);
 
@@ -222,5 +222,5 @@
 	usb_transfer_batch_t * const batch = ep->active_batch;
 
-	const int err = hc_stop_endpoint(xhci_ep);
+	const errno_t err = hc_stop_endpoint(xhci_ep);
 	if (err) {
 		usb_log_error("Failed to stop endpoint %u of device "
@@ -245,5 +245,5 @@
 void xhci_endpoint_unregister(endpoint_t *ep_base)
 {
-	int err;
+	errno_t err;
 	xhci_endpoint_t *ep = xhci_endpoint_get(ep_base);
 	xhci_device_t *dev = xhci_device_get(ep_base->device);
@@ -300,5 +300,5 @@
  * @return Error code.
  */
-static int alloc_transfer_ds(xhci_endpoint_t *xhci_ep)
+static errno_t alloc_transfer_ds(xhci_endpoint_t *xhci_ep)
 {
 	/* Can't use XHCI_EP_FMT because the endpoint may not have device. */
@@ -309,5 +309,5 @@
 	xhci_ep->primary_stream_data_size = 0;
 
-	int err;
+	errno_t err;
 	if ((err = xhci_trb_ring_init(&xhci_ep->ring, 0))) {
 		return err;
@@ -460,7 +460,7 @@
  * offending transfer.
  */
-int xhci_endpoint_clear_halt(xhci_endpoint_t *ep, uint32_t stream_id)
-{
-	int err;
+errno_t xhci_endpoint_clear_halt(xhci_endpoint_t *ep, uint32_t stream_id)
+{
+	errno_t err;
 
 	if ((err = hc_reset_endpoint(ep)))
Index: uspace/drv/bus/usb/xhci/endpoint.h
===================================================================
--- uspace/drv/bus/usb/xhci/endpoint.h	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/endpoint.h	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -112,5 +112,5 @@
 
 extern endpoint_t *xhci_endpoint_create(device_t *, const usb_endpoint_descriptors_t *);
-extern int xhci_endpoint_register(endpoint_t *);
+extern errno_t xhci_endpoint_register(endpoint_t *);
 extern void xhci_endpoint_unregister(endpoint_t *);
 extern void xhci_endpoint_destroy(endpoint_t *);
@@ -120,5 +120,5 @@
 
 extern void xhci_setup_endpoint_context(xhci_endpoint_t *, xhci_ep_ctx_t *);
-extern int xhci_endpoint_clear_halt(xhci_endpoint_t *, unsigned);
+extern errno_t xhci_endpoint_clear_halt(xhci_endpoint_t *, unsigned);
 
 static inline xhci_endpoint_t * xhci_endpoint_get(endpoint_t *ep)
Index: uspace/drv/bus/usb/xhci/hc.c
===================================================================
--- uspace/drv/bus/usb/xhci/hc.c	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/hc.c	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -80,5 +80,5 @@
  * ports to protocol versions and speeds.
  */
-static int hc_parse_ec(xhci_hc_t *hc)
+static errno_t hc_parse_ec(xhci_hc_t *hc)
 {
 	unsigned psic, major, minor;
@@ -186,7 +186,7 @@
  * Initialize MMIO spaces of xHC.
  */
-int hc_init_mmio(xhci_hc_t *hc, const hw_res_list_parsed_t *hw_res)
-{
-	int err;
+errno_t hc_init_mmio(xhci_hc_t *hc, const hw_res_list_parsed_t *hw_res)
+{
+	errno_t err;
 
 	if (hw_res->mem_ranges.count != 1) {
@@ -257,7 +257,7 @@
  * Initialize structures kept in allocated memory.
  */
-int hc_init_memory(xhci_hc_t *hc, ddf_dev_t *device)
-{
-	int err = ENOMEM;
+errno_t hc_init_memory(xhci_hc_t *hc, ddf_dev_t *device)
+{
+	errno_t err = ENOMEM;
 
 	if (dma_buffer_alloc(&hc->dcbaa_dma, (1 + hc->max_slots) * sizeof(uint64_t)))
@@ -362,5 +362,5 @@
  * (except 0) are disabled.
  */
-int hc_irq_code_gen(irq_code_t *code, xhci_hc_t *hc, const hw_res_list_parsed_t *hw_res, int *irq)
+errno_t hc_irq_code_gen(irq_code_t *code, xhci_hc_t *hc, const hw_res_list_parsed_t *hw_res, int *irq)
 {
 	assert(code);
@@ -412,5 +412,5 @@
  * Claim xHC from BIOS. Implements handoff as per Section 4.22.1 of xHCI spec.
  */
-int hc_claim(xhci_hc_t *hc, ddf_dev_t *dev)
+errno_t hc_claim(xhci_hc_t *hc, ddf_dev_t *dev)
 {
 	/* No legacy support capability, the controller is solely for us */
@@ -440,5 +440,5 @@
  * Ask the xHC to reset its state. Implements sequence
  */
-static int hc_reset(xhci_hc_t *hc)
+static errno_t hc_reset(xhci_hc_t *hc)
 {
 	if (xhci_reg_wait(&hc->op_regs->usbsts, XHCI_REG_MASK(XHCI_OP_CNR), 0))
@@ -466,7 +466,7 @@
  * Initialize the HC: section 4.2
  */
-int hc_start(xhci_hc_t *hc)
-{
-	int err;
+errno_t hc_start(xhci_hc_t *hc)
+{
+	errno_t err;
 
 	if ((err = hc_reset(hc)))
@@ -565,5 +565,5 @@
  * Used only when polling. Shall supplement the irq_commands.
  */
-int hc_status(bus_t *bus, uint32_t *status)
+errno_t hc_status(bus_t *bus, uint32_t *status)
 {
 	xhci_hc_t *hc = bus_to_hc(bus);
@@ -583,5 +583,5 @@
 }
 
-static int xhci_handle_mfindex_wrap_event(xhci_hc_t *hc, xhci_trb_t *trb)
+static errno_t xhci_handle_mfindex_wrap_event(xhci_hc_t *hc, xhci_trb_t *trb)
 {
 	struct timeval tv;
@@ -594,5 +594,5 @@
 }
 
-typedef int (*event_handler) (xhci_hc_t *, xhci_trb_t *trb);
+typedef errno_t (*event_handler) (xhci_hc_t *, xhci_trb_t *trb);
 
 /**
@@ -612,5 +612,5 @@
 };
 
-static int hc_handle_event(xhci_hc_t *hc, xhci_trb_t *trb)
+static errno_t hc_handle_event(xhci_hc_t *hc, xhci_trb_t *trb)
 {
 	const unsigned type = TRB_TYPE(*trb);
@@ -630,5 +630,5 @@
 static int event_worker(void *arg)
 {
-	int err;
+	errno_t err;
 	xhci_trb_t trb;
 	xhci_hc_t * const hc = arg;
@@ -654,5 +654,5 @@
     xhci_interrupter_regs_t *intr)
 {
-	int err;
+	errno_t err;
 
 	xhci_trb_t trb;
@@ -781,7 +781,7 @@
  * DCBAA with the newly created slot.
  */
-int hc_enable_slot(xhci_device_t *dev)
-{
-	int err;
+errno_t hc_enable_slot(xhci_device_t *dev)
+{
+	errno_t err;
 	xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
 
@@ -815,7 +815,7 @@
  * Frees the device context.
  */
-int hc_disable_slot(xhci_device_t *dev)
-{
-	int err;
+errno_t hc_disable_slot(xhci_device_t *dev)
+{
+	errno_t err;
 	xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
 
@@ -837,8 +837,8 @@
  * Prepare an empty Endpoint Input Context inside a dma buffer.
  */
-static int create_configure_ep_input_ctx(xhci_device_t *dev, dma_buffer_t *dma_buf)
+static errno_t create_configure_ep_input_ctx(xhci_device_t *dev, dma_buffer_t *dma_buf)
 {
 	const xhci_hc_t * hc = bus_to_hc(dev->base.bus);
-	const int err = dma_buffer_alloc(dma_buf, XHCI_INPUT_CTX_SIZE(hc));
+	const errno_t err = dma_buffer_alloc(dma_buf, XHCI_INPUT_CTX_SIZE(hc));
 	if (err)
 		return err;
@@ -860,7 +860,7 @@
  * @param dev Device to assing an address (unconfigured yet)
  */
-int hc_address_device(xhci_device_t *dev)
-{
-	int err = ENOMEM;
+errno_t hc_address_device(xhci_device_t *dev)
+{
+	errno_t err = ENOMEM;
 	xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
 	xhci_endpoint_t *ep0 = xhci_endpoint_get(dev->base.endpoints[0]);
@@ -908,5 +908,5 @@
  * @param slot_id Slot ID assigned to the device.
  */
-int hc_configure_device(xhci_device_t *dev)
+errno_t hc_configure_device(xhci_device_t *dev)
 {
 	xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
@@ -914,5 +914,5 @@
 	/* Issue configure endpoint command (sec 4.3.5). */
 	dma_buffer_t ictx_dma_buf;
-	const int err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
+	const errno_t err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
 	if (err)
 		return err;
@@ -929,5 +929,5 @@
  * @param dev The owner of the device
  */
-int hc_deconfigure_device(xhci_device_t *dev)
+errno_t hc_deconfigure_device(xhci_device_t *dev)
 {
 	xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
@@ -950,5 +950,5 @@
  * @param ep_ctx Endpoint context of the endpoint
  */
-int hc_add_endpoint(xhci_endpoint_t *ep)
+errno_t hc_add_endpoint(xhci_endpoint_t *ep)
 {
 	xhci_device_t * const dev = xhci_ep_to_dev(ep);
@@ -957,5 +957,5 @@
 	/* Issue configure endpoint command (sec 4.3.5). */
 	dma_buffer_t ictx_dma_buf;
-	const int err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
+	const errno_t err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
 	if (err)
 		return err;
@@ -981,5 +981,5 @@
  * @param ep_idx Endpoint DCI in question
  */
-int hc_drop_endpoint(xhci_endpoint_t *ep)
+errno_t hc_drop_endpoint(xhci_endpoint_t *ep)
 {
 	xhci_device_t * const dev = xhci_ep_to_dev(ep);
@@ -992,5 +992,5 @@
 	/* Issue configure endpoint command (sec 4.3.5). */
 	dma_buffer_t ictx_dma_buf;
-	const int err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
+	const errno_t err = create_configure_ep_input_ctx(dev, &ictx_dma_buf);
 	if (err)
 		return err;
@@ -1013,5 +1013,5 @@
  * @param ep_ctx Endpoint context of the endpoint
  */
-int hc_update_endpoint(xhci_endpoint_t *ep)
+errno_t hc_update_endpoint(xhci_endpoint_t *ep)
 {
 	xhci_device_t * const dev = xhci_ep_to_dev(ep);
@@ -1021,5 +1021,5 @@
 	xhci_hc_t * const hc = bus_to_hc(dev->base.bus);
 
-	const int err = dma_buffer_alloc(&ictx_dma_buf, XHCI_INPUT_CTX_SIZE(hc));
+	const errno_t err = dma_buffer_alloc(&ictx_dma_buf, XHCI_INPUT_CTX_SIZE(hc));
 	if (err)
 		return err;
@@ -1044,5 +1044,5 @@
  * @param ep_idx Endpoint DCI in question
  */
-int hc_stop_endpoint(xhci_endpoint_t *ep)
+errno_t hc_stop_endpoint(xhci_endpoint_t *ep)
 {
 	xhci_device_t * const dev = xhci_ep_to_dev(ep);
@@ -1065,5 +1065,5 @@
  * @param ep_idx Endpoint DCI in question
  */
-int hc_reset_endpoint(xhci_endpoint_t *ep)
+errno_t hc_reset_endpoint(xhci_endpoint_t *ep)
 {
 	xhci_device_t * const dev = xhci_ep_to_dev(ep);
@@ -1081,5 +1081,5 @@
  * @param dev The owner of the endpoint
  */
-int hc_reset_ring(xhci_endpoint_t *ep, uint32_t stream_id)
+errno_t hc_reset_ring(xhci_endpoint_t *ep, uint32_t stream_id)
 {
 	xhci_device_t * const dev = xhci_ep_to_dev(ep);
Index: uspace/drv/bus/usb/xhci/hc.h
===================================================================
--- uspace/drv/bus/usb/xhci/hc.h	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/hc.h	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -112,9 +112,9 @@
 typedef struct xhci_device xhci_device_t;
 
-extern int hc_init_mmio(xhci_hc_t *, const hw_res_list_parsed_t *);
-extern int hc_init_memory(xhci_hc_t *, ddf_dev_t *);
-extern int hc_claim(xhci_hc_t *, ddf_dev_t *);
-extern int hc_irq_code_gen(irq_code_t *, xhci_hc_t *, const hw_res_list_parsed_t *, int *);
-extern int hc_start(xhci_hc_t *);
+extern errno_t hc_init_mmio(xhci_hc_t *, const hw_res_list_parsed_t *);
+extern errno_t hc_init_memory(xhci_hc_t *, ddf_dev_t *);
+extern errno_t hc_claim(xhci_hc_t *, ddf_dev_t *);
+extern errno_t hc_irq_code_gen(irq_code_t *, xhci_hc_t *, const hw_res_list_parsed_t *, int *);
+extern errno_t hc_start(xhci_hc_t *);
 extern void hc_fini(xhci_hc_t *);
 
@@ -123,17 +123,17 @@
 extern unsigned hc_speed_to_psiv(usb_speed_t);
 
-extern int hc_enable_slot(xhci_device_t *);
-extern int hc_disable_slot(xhci_device_t *);
-extern int hc_address_device(xhci_device_t *);
-extern int hc_configure_device(xhci_device_t *);
-extern int hc_deconfigure_device(xhci_device_t *);
-extern int hc_add_endpoint(xhci_endpoint_t *);
-extern int hc_drop_endpoint(xhci_endpoint_t *);
-extern int hc_update_endpoint(xhci_endpoint_t *);
-extern int hc_stop_endpoint(xhci_endpoint_t *);
-extern int hc_reset_endpoint(xhci_endpoint_t *);
-extern int hc_reset_ring(xhci_endpoint_t *, uint32_t);
+extern errno_t hc_enable_slot(xhci_device_t *);
+extern errno_t hc_disable_slot(xhci_device_t *);
+extern errno_t hc_address_device(xhci_device_t *);
+extern errno_t hc_configure_device(xhci_device_t *);
+extern errno_t hc_deconfigure_device(xhci_device_t *);
+extern errno_t hc_add_endpoint(xhci_endpoint_t *);
+extern errno_t hc_drop_endpoint(xhci_endpoint_t *);
+extern errno_t hc_update_endpoint(xhci_endpoint_t *);
+extern errno_t hc_stop_endpoint(xhci_endpoint_t *);
+extern errno_t hc_reset_endpoint(xhci_endpoint_t *);
+extern errno_t hc_reset_ring(xhci_endpoint_t *, uint32_t);
 
-extern int hc_status(bus_t *, uint32_t *);
+extern errno_t hc_status(bus_t *, uint32_t *);
 extern void hc_interrupt(bus_t *, uint32_t);
 
Index: uspace/drv/bus/usb/xhci/isoch.c
===================================================================
--- uspace/drv/bus/usb/xhci/isoch.c	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/isoch.c	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -141,5 +141,5 @@
  * Allocate isochronous buffers. Create the feeding timer.
  */
-int isoch_alloc_transfers(xhci_endpoint_t *ep) {
+errno_t isoch_alloc_transfers(xhci_endpoint_t *ep) {
 	assert(ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS);
 	xhci_isoch_t * const isoch = ep->isoch;
@@ -171,5 +171,5 @@
 }
 
-static int schedule_isochronous_trb(xhci_endpoint_t *ep, xhci_isoch_transfer_t *it)
+static errno_t schedule_isochronous_trb(xhci_endpoint_t *ep, xhci_isoch_transfer_t *it)
 {
 	xhci_trb_t trb;
@@ -193,5 +193,5 @@
 	TRB_ISOCH_SET_FRAMEID(trb, (it->mfindex / 8) % 2048);
 
-	const int err = xhci_trb_ring_enqueue(&ep->ring, &trb, &it->interrupt_trb_phys);
+	const errno_t err = xhci_trb_ring_enqueue(&ep->ring, &trb, &it->interrupt_trb_phys);
 	return err;
 }
@@ -472,7 +472,7 @@
  * it to the xHC.
  */
-int isoch_schedule_out(xhci_transfer_t *transfer)
-{
-	int err = EOK;
+errno_t isoch_schedule_out(xhci_transfer_t *transfer)
+{
+	errno_t err = EOK;
 
 	xhci_endpoint_t *ep = xhci_endpoint_get(transfer->batch.ep);
@@ -540,5 +540,5 @@
  * buffers, and fetch one filled buffer from the ring.
  */
-int isoch_schedule_in(xhci_transfer_t *transfer)
+errno_t isoch_schedule_in(xhci_transfer_t *transfer)
 {
 	xhci_endpoint_t *ep = xhci_endpoint_get(transfer->batch.ep);
@@ -595,5 +595,5 @@
 	fibril_mutex_lock(&ep->isoch->guard);
 
-	int err;
+	errno_t err;
 	const xhci_trb_completion_code_t completion_code = TRB_COMPLETION_CODE(*trb);
 
Index: uspace/drv/bus/usb/xhci/isoch.h
===================================================================
--- uspace/drv/bus/usb/xhci/isoch.h	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/isoch.h	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -68,5 +68,5 @@
 
 	/** Result of the transfer. Valid only if status == ISOCH_COMPLETE. */
-	int error;
+	errno_t error;
 } xhci_isoch_transfer_t;
 
@@ -119,8 +119,8 @@
 extern void isoch_init(xhci_endpoint_t *, const usb_endpoint_descriptors_t *);
 extern void isoch_fini(xhci_endpoint_t *);
-extern int isoch_alloc_transfers(xhci_endpoint_t *);
+extern errno_t isoch_alloc_transfers(xhci_endpoint_t *);
 
-extern int isoch_schedule_out(xhci_transfer_t *);
-extern int isoch_schedule_in(xhci_transfer_t *);
+extern errno_t isoch_schedule_out(xhci_transfer_t *);
+extern errno_t isoch_schedule_in(xhci_transfer_t *);
 extern void isoch_handle_transfer_event(xhci_hc_t *, xhci_endpoint_t *, xhci_trb_t *);
 
Index: uspace/drv/bus/usb/xhci/main.c
===================================================================
--- uspace/drv/bus/usb/xhci/main.c	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/main.c	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -53,7 +53,7 @@
 }
 
-static int hcd_hc_add(hc_device_t *hcd, const hw_res_list_parsed_t *hw_res)
+static errno_t hcd_hc_add(hc_device_t *hcd, const hw_res_list_parsed_t *hw_res)
 {
-	int err;
+	errno_t err;
 	xhci_hc_t *hc = hcd_to_hc(hcd);
 	hc_device_setup(hcd, (bus_t *) &hc->bus);
@@ -68,5 +68,5 @@
 }
 
-static int hcd_irq_code_gen(irq_code_t *code, hc_device_t *hcd, const hw_res_list_parsed_t *hw_res, int *irq)
+static errno_t hcd_irq_code_gen(irq_code_t *code, hc_device_t *hcd, const hw_res_list_parsed_t *hw_res, int *irq)
 {
 	xhci_hc_t *hc = hcd_to_hc(hcd);
@@ -74,5 +74,5 @@
 }
 
-static int hcd_claim(hc_device_t *hcd)
+static errno_t hcd_claim(hc_device_t *hcd)
 {
 	xhci_hc_t *hc = hcd_to_hc(hcd);
@@ -80,5 +80,5 @@
 }
 
-static int hcd_start(hc_device_t *hcd)
+static errno_t hcd_start(hc_device_t *hcd)
 {
 	xhci_hc_t *hc = hcd_to_hc(hcd);
@@ -86,5 +86,5 @@
 }
 
-static int hcd_hc_gone(hc_device_t *hcd)
+static errno_t hcd_hc_gone(hc_device_t *hcd)
 {
 	xhci_hc_t *hc = hcd_to_hc(hcd);
@@ -112,5 +112,5 @@
  * Driver debug level is set here.
  */
-int main(int argc, char *argv[])
+errno_t main(int argc, char *argv[])
 {
 	log_init(NAME);
Index: uspace/drv/bus/usb/xhci/rh.c
===================================================================
--- uspace/drv/bus/usb/xhci/rh.c	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/rh.c	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -79,5 +79,5 @@
  * Initialize the roothub subsystem.
  */
-int xhci_rh_init(xhci_rh_t *rh, xhci_hc_t *hc)
+errno_t xhci_rh_init(xhci_rh_t *rh, xhci_hc_t *hc)
 {
 	assert(rh);
@@ -90,5 +90,5 @@
 		return ENOMEM;
 
-	const int err = bus_device_init(&rh->device.base, &rh->hc->bus.base);
+	const errno_t err = bus_device_init(&rh->device.base, &rh->hc->bus.base);
 	if (err) {
 		free(rh->ports);
@@ -119,5 +119,5 @@
  * Finalize the RH subsystem.
  */
-int xhci_rh_fini(xhci_rh_t *rh)
+errno_t xhci_rh_fini(xhci_rh_t *rh)
 {
 	assert(rh);
@@ -139,7 +139,7 @@
  * a virtual usbhub device for RH, this routine is called for devices directly.
  */
-static int rh_enumerate_device(usb_port_t *usb_port)
-{
-	int err;
+static errno_t rh_enumerate_device(usb_port_t *usb_port)
+{
+	errno_t err;
 	rh_port_t *port = get_rh_port(usb_port);
 
Index: uspace/drv/bus/usb/xhci/rh.h
===================================================================
--- uspace/drv/bus/usb/xhci/rh.h	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/rh.h	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -81,6 +81,6 @@
 } xhci_rh_t;
 
-extern int xhci_rh_init(xhci_rh_t *, xhci_hc_t *);
-extern int xhci_rh_fini(xhci_rh_t *);
+extern errno_t xhci_rh_init(xhci_rh_t *, xhci_hc_t *);
+extern errno_t xhci_rh_fini(xhci_rh_t *);
 
 extern void xhci_rh_set_ports_protocol(xhci_rh_t *, unsigned, unsigned, unsigned);
Index: uspace/drv/bus/usb/xhci/scratchpad.c
===================================================================
--- uspace/drv/bus/usb/xhci/scratchpad.c	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/scratchpad.c	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -57,5 +57,5 @@
  * Allocate all scratchpad buffers, and configure the xHC.
  */
-int xhci_scratchpad_alloc(xhci_hc_t *hc)
+errno_t xhci_scratchpad_alloc(xhci_hc_t *hc)
 {
 	const unsigned num_bufs = xhci_scratchpad_count(hc);
Index: uspace/drv/bus/usb/xhci/scratchpad.h
===================================================================
--- uspace/drv/bus/usb/xhci/scratchpad.h	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/scratchpad.h	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -45,5 +45,5 @@
 typedef struct xhci_hc xhci_hc_t;
 
-extern int xhci_scratchpad_alloc(xhci_hc_t *);
+extern errno_t xhci_scratchpad_alloc(xhci_hc_t *);
 extern void xhci_scratchpad_free(xhci_hc_t *);
 
Index: uspace/drv/bus/usb/xhci/streams.c
===================================================================
--- uspace/drv/bus/usb/xhci/streams.c	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/streams.c	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -85,5 +85,5 @@
  * @param[in] count Amount of primary streams.
  */
-static int initialize_primary_structures(xhci_endpoint_t *xhci_ep, unsigned count)
+static errno_t initialize_primary_structures(xhci_endpoint_t *xhci_ep, unsigned count)
 {
 	usb_log_debug("Allocating primary stream context array of size %u "
@@ -152,6 +152,6 @@
  * @param[in] index index of the initialized stream structure.
  */
-static int initialize_primary_stream(xhci_hc_t *hc, xhci_endpoint_t *xhci_ep,
-    unsigned index)
+static errno_t initialize_primary_stream(xhci_hc_t *hc, xhci_endpoint_t *xhci_ep,
+	unsigned index)
 {
 	xhci_stream_ctx_t *ctx = &xhci_ep->primary_stream_ctx_array[index];
@@ -159,5 +159,5 @@
 	memset(data, 0, sizeof(xhci_stream_data_t));
 
-	int err = EOK;
+	errno_t err = EOK;
 
 	/* Init and register TRB ring for the primary stream */
@@ -178,7 +178,7 @@
  * @param[in] xhci_ep XHCI bulk endpoint to use.
  */
-static int initialize_primary_streams(xhci_hc_t *hc, xhci_endpoint_t *xhci_ep)
-{
-	int err = EOK;
+static errno_t initialize_primary_streams(xhci_hc_t *hc, xhci_endpoint_t *xhci_ep)
+{
+	errno_t err = EOK;
 	size_t index;
 	for (index = 0; index < xhci_ep->primary_stream_data_size; ++index) {
@@ -205,6 +205,6 @@
  * @param[in] count Number of secondary streams to initialize.
  */
-static int initialize_secondary_streams(xhci_hc_t *hc, xhci_endpoint_t *xhci_ep,
-    unsigned idx, unsigned count)
+static errno_t initialize_secondary_streams(xhci_hc_t *hc, xhci_endpoint_t *xhci_ep,
+	unsigned idx, unsigned count)
 {
 	if (count == 0) {
@@ -243,5 +243,5 @@
 
 	/* Initialize all the rings. */
-	int err = EOK;
+	errno_t err = EOK;
 	size_t index;
 	for (index = 0; index < count; ++index) {
@@ -275,5 +275,5 @@
  */
 static void setup_stream_context(xhci_endpoint_t *xhci_ep, xhci_ep_ctx_t *ctx,
-    unsigned pstreams, unsigned lsa)
+	unsigned pstreams, unsigned lsa)
 {
 	XHCI_EP_TYPE_SET(*ctx, xhci_endpoint_type(xhci_ep));
@@ -294,5 +294,5 @@
  * @param[in] count Amount of primary streams requested.
  */
-static int verify_stream_conditions(xhci_hc_t *hc, xhci_device_t *dev,
+static errno_t verify_stream_conditions(xhci_hc_t *hc, xhci_device_t *dev,
 	xhci_endpoint_t *xhci_ep, unsigned count)
 {
@@ -345,6 +345,6 @@
  * @param[in] xhci_ep Associated XHCI bulk endpoint.
  */
-int xhci_endpoint_remove_streams(xhci_hc_t *hc, xhci_device_t *dev,
-    xhci_endpoint_t *xhci_ep)
+errno_t xhci_endpoint_remove_streams(xhci_hc_t *hc, xhci_device_t *dev,
+	xhci_endpoint_t *xhci_ep)
 {
 	if (!xhci_ep->primary_stream_data_size) {
@@ -357,5 +357,5 @@
 
 	/* Streams are now removed, proceed with reconfiguring endpoint. */
-	int err;
+	errno_t err;
 	if ((err = xhci_trb_ring_init(&xhci_ep->ring, 0))) {
 		usb_log_error("Failed to initialize a transfer ring.");
@@ -373,8 +373,8 @@
  * @param[in] count Amount of primary streams requested.
  */
-int xhci_endpoint_request_primary_streams(xhci_hc_t *hc, xhci_device_t *dev,
+errno_t xhci_endpoint_request_primary_streams(xhci_hc_t *hc, xhci_device_t *dev,
 	xhci_endpoint_t *xhci_ep, unsigned count)
 {
-	int err = verify_stream_conditions(hc, dev, xhci_ep, count);
+	errno_t err = verify_stream_conditions(hc, dev, xhci_ep, count);
 	if (err) {
 		return err;
@@ -421,5 +421,5 @@
  * @param[in] count Amount of primary streams requested.
  */
-int xhci_endpoint_request_secondary_streams(xhci_hc_t *hc, xhci_device_t *dev,
+errno_t xhci_endpoint_request_secondary_streams(xhci_hc_t *hc, xhci_device_t *dev,
 	xhci_endpoint_t *xhci_ep, unsigned *sizes, unsigned count)
 {
@@ -430,5 +430,5 @@
 	}
 
-	int err = verify_stream_conditions(hc, dev, xhci_ep, count);
+	errno_t err = verify_stream_conditions(hc, dev, xhci_ep, count);
 	if (err) {
 		return err;
Index: uspace/drv/bus/usb/xhci/streams.h
===================================================================
--- uspace/drv/bus/usb/xhci/streams.h	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/streams.h	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -64,8 +64,8 @@
 extern void xhci_stream_free_ds(xhci_endpoint_t *xhci_ep);
 
-extern int xhci_endpoint_remove_streams(xhci_hc_t *hc, xhci_device_t *dev, xhci_endpoint_t *xhci_ep);
-extern int xhci_endpoint_request_primary_streams(xhci_hc_t *hc, xhci_device_t *dev,
+extern errno_t xhci_endpoint_remove_streams(xhci_hc_t *hc, xhci_device_t *dev, xhci_endpoint_t *xhci_ep);
+extern errno_t xhci_endpoint_request_primary_streams(xhci_hc_t *hc, xhci_device_t *dev,
 	xhci_endpoint_t *xhci_ep, unsigned count);
-extern int xhci_endpoint_request_secondary_streams(xhci_hc_t *hc, xhci_device_t *dev,
+extern errno_t xhci_endpoint_request_secondary_streams(xhci_hc_t *hc, xhci_device_t *dev,
 	xhci_endpoint_t *xhci_ep, unsigned *sizes, unsigned count);
 
Index: uspace/drv/bus/usb/xhci/transfers.c
===================================================================
--- uspace/drv/bus/usb/xhci/transfers.c	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/transfers.c	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -150,5 +150,5 @@
 }
 
-static int schedule_control(xhci_hc_t* hc, xhci_transfer_t* transfer)
+static errno_t schedule_control(xhci_hc_t* hc, xhci_transfer_t* transfer)
 {
 	usb_transfer_batch_t *batch = &transfer->batch;
@@ -213,5 +213,5 @@
 	// Issue a Configure Endpoint command, if needed.
 	if (configure_endpoint_needed(setup)) {
-		const int err = hc_configure_device(xhci_ep_to_dev(xhci_ep));
+		const errno_t err = hc_configure_device(xhci_ep_to_dev(xhci_ep));
 		if (err)
 			return err;
@@ -222,5 +222,5 @@
 }
 
-static int schedule_bulk(xhci_hc_t* hc, xhci_transfer_t *transfer)
+static errno_t schedule_bulk(xhci_hc_t* hc, xhci_transfer_t *transfer)
 {
 	/* The stream-enabled endpoints need to chain ED trb */
@@ -276,5 +276,5 @@
 }
 
-static int schedule_interrupt(xhci_hc_t* hc, xhci_transfer_t* transfer)
+static errno_t schedule_interrupt(xhci_hc_t* hc, xhci_transfer_t* transfer)
 {
 	const size_t buffer_count = calculate_trb_count(transfer);
@@ -309,5 +309,5 @@
 }
 
-int xhci_handle_transfer_event(xhci_hc_t* hc, xhci_trb_t* trb)
+errno_t xhci_handle_transfer_event(xhci_hc_t* hc, xhci_trb_t* trb)
 {
 	uintptr_t addr = trb->parameter;
@@ -430,5 +430,5 @@
 }
 
-typedef int (*transfer_handler)(xhci_hc_t *, xhci_transfer_t *);
+typedef errno_t (*transfer_handler)(xhci_hc_t *, xhci_transfer_t *);
 
 static const transfer_handler transfer_handlers[] = {
@@ -444,5 +444,5 @@
  * Bus callback.
  */
-int xhci_transfer_schedule(usb_transfer_batch_t *batch)
+errno_t xhci_transfer_schedule(usb_transfer_batch_t *batch)
 {
 	endpoint_t *ep = batch->ep;
@@ -504,5 +504,5 @@
 				 * possible that we have to clear all of them.
 				 */
-				const int err = xhci_endpoint_clear_halt(xhci_endpoint_get(halted_ep), 0);
+				const errno_t err = xhci_endpoint_clear_halt(xhci_endpoint_get(halted_ep), 0);
 				endpoint_del_ref(halted_ep);
 				if (err) {
@@ -526,5 +526,5 @@
 
 
-	int err;
+	errno_t err;
 	fibril_mutex_lock(&xhci_ep->guard);
 
Index: uspace/drv/bus/usb/xhci/transfers.h
===================================================================
--- uspace/drv/bus/usb/xhci/transfers.h	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/transfers.h	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -56,7 +56,7 @@
 
 extern usb_transfer_batch_t* xhci_transfer_create(endpoint_t *);
-extern int xhci_transfer_schedule(usb_transfer_batch_t *);
+extern errno_t xhci_transfer_schedule(usb_transfer_batch_t *);
 
-extern int xhci_handle_transfer_event(xhci_hc_t *, xhci_trb_t *);
+extern errno_t xhci_handle_transfer_event(xhci_hc_t *, xhci_trb_t *);
 extern void xhci_transfer_destroy(usb_transfer_batch_t *);
 
Index: uspace/drv/bus/usb/xhci/trb_ring.c
===================================================================
--- uspace/drv/bus/usb/xhci/trb_ring.c	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/trb_ring.c	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -87,9 +87,9 @@
  * to DMAMEM_4GiB.
  */
-static int trb_segment_alloc(trb_segment_t **segment)
+static errno_t trb_segment_alloc(trb_segment_t **segment)
 {
 	dma_buffer_t dbuf;
 
-	const int err = dma_buffer_alloc(&dbuf, PAGE_SIZE);
+	const errno_t err = dma_buffer_alloc(&dbuf, PAGE_SIZE);
 	if (err)
 		return err;
@@ -114,7 +114,7 @@
  * choice on a reasonable default (one page-sized segment).
  */
-int xhci_trb_ring_init(xhci_trb_ring_t *ring, size_t initial_size)
-{
-	int err;
+errno_t xhci_trb_ring_init(xhci_trb_ring_t *ring, size_t initial_size)
+{
+	errno_t err;
 	if (initial_size == 0)
 		initial_size = SEGMENT_TRB_USEFUL_COUNT;
@@ -218,8 +218,8 @@
  *         EAGAIN when the ring is too full to fit all TRBs (temporary)
  */
-int xhci_trb_ring_enqueue_multiple(xhci_trb_ring_t *ring, xhci_trb_t *first_trb,
+errno_t xhci_trb_ring_enqueue_multiple(xhci_trb_ring_t *ring, xhci_trb_t *first_trb,
 	size_t trbs, uintptr_t *phys)
 {
-	int err;
+	errno_t err;
 	assert(trbs > 0);
 	fibril_mutex_lock(&ring->guard);
@@ -294,5 +294,5 @@
  * Enqueue TD composed of a single TRB. See: `xhci_trb_ring_enqueue_multiple`
  */
-int xhci_trb_ring_enqueue(xhci_trb_ring_t *ring, xhci_trb_t *td, uintptr_t *phys)
+errno_t xhci_trb_ring_enqueue(xhci_trb_ring_t *ring, xhci_trb_t *td, uintptr_t *phys)
 {
 	return xhci_trb_ring_enqueue_multiple(ring, td, 1, phys);
@@ -315,7 +315,7 @@
  * choice on a reasonable default (one page-sized segment).
  */
-int xhci_event_ring_init(xhci_event_ring_t *ring, size_t initial_size)
-{
-	int err;
+errno_t xhci_event_ring_init(xhci_event_ring_t *ring, size_t initial_size)
+{
+	errno_t err;
 	if (initial_size == 0)
 		initial_size = SEGMENT_TRB_COUNT;
@@ -390,5 +390,5 @@
  *         ENOENT when the ring is empty
  */
-int xhci_event_ring_dequeue(xhci_event_ring_t *ring, xhci_trb_t *event)
+errno_t xhci_event_ring_dequeue(xhci_event_ring_t *ring, xhci_trb_t *event)
 {
 	fibril_mutex_lock(&ring->guard);
@@ -445,5 +445,5 @@
 }
 
-int xhci_sw_ring_enqueue(xhci_sw_ring_t *ring, xhci_trb_t *trb)
+errno_t xhci_sw_ring_enqueue(xhci_sw_ring_t *ring, xhci_trb_t *trb)
 {
 	assert(ring);
@@ -464,5 +464,5 @@
 }
 
-int xhci_sw_ring_dequeue(xhci_sw_ring_t *ring, xhci_trb_t *trb)
+errno_t xhci_sw_ring_dequeue(xhci_sw_ring_t *ring, xhci_trb_t *trb)
 {
 	assert(ring);
Index: uspace/drv/bus/usb/xhci/trb_ring.h
===================================================================
--- uspace/drv/bus/usb/xhci/trb_ring.h	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/drv/bus/usb/xhci/trb_ring.h	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -74,8 +74,8 @@
 } xhci_trb_ring_t;
 
-extern int xhci_trb_ring_init(xhci_trb_ring_t *, size_t);
+extern errno_t xhci_trb_ring_init(xhci_trb_ring_t *, size_t);
 extern void xhci_trb_ring_fini(xhci_trb_ring_t *);
-extern int xhci_trb_ring_enqueue(xhci_trb_ring_t *, xhci_trb_t *, uintptr_t *);
-extern int xhci_trb_ring_enqueue_multiple(xhci_trb_ring_t *, xhci_trb_t *, size_t, uintptr_t *);
+extern errno_t xhci_trb_ring_enqueue(xhci_trb_ring_t *, xhci_trb_t *, uintptr_t *);
+extern errno_t xhci_trb_ring_enqueue_multiple(xhci_trb_ring_t *, xhci_trb_t *, size_t, uintptr_t *);
 
 extern void xhci_trb_ring_reset_dequeue_state(xhci_trb_ring_t *ring, uintptr_t *addr);
@@ -107,8 +107,8 @@
 } xhci_event_ring_t;
 
-extern int xhci_event_ring_init(xhci_event_ring_t *, size_t);
+extern errno_t xhci_event_ring_init(xhci_event_ring_t *, size_t);
 extern void xhci_event_ring_fini(xhci_event_ring_t *);
 extern void xhci_event_ring_reset(xhci_event_ring_t *);
-extern int xhci_event_ring_dequeue(xhci_event_ring_t *, xhci_trb_t *);
+extern errno_t xhci_event_ring_dequeue(xhci_event_ring_t *, xhci_trb_t *);
 
 /**
@@ -128,6 +128,6 @@
 
 /* Both may block if the ring is full/empty. */
-extern int xhci_sw_ring_enqueue(xhci_sw_ring_t *, xhci_trb_t *);
-extern int xhci_sw_ring_dequeue(xhci_sw_ring_t *, xhci_trb_t *);
+extern errno_t xhci_sw_ring_enqueue(xhci_sw_ring_t *, xhci_trb_t *);
+extern errno_t xhci_sw_ring_dequeue(xhci_sw_ring_t *, xhci_trb_t *);
 
 extern void xhci_sw_ring_restart(xhci_sw_ring_t *);
Index: uspace/lib/drv/generic/driver.c
===================================================================
--- uspace/lib/drv/generic/driver.c	(revision 961a5ee6a39f4b63d8092b4429f5cd10fd784e2a)
+++ uspace/lib/drv/generic/driver.c	(revision 45457265072881ea3db34a5feaa13f1ca7c28c4c)
@@ -971,5 +971,5 @@
 }
 
-int ddf_driver_main(const driver_t *drv)
+errno_t ddf_driver_main(const driver_t *drv)
 {
 	/*
