Index: uspace/app/bdsh/cmds/modules/cmp/cmp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cmp/cmp.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/app/bdsh/cmds/modules/cmp/cmp.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -101,5 +101,5 @@
 		    memcmp(buffer[0], buffer[1], offset[0]) != 0) {
 			printf("Return 1\n");
-			rc = 1;
+			rc = EBUSY;
 			goto end;
 		}
Index: uspace/app/bdsh/cmds/modules/cp/cp.c
===================================================================
--- uspace/app/bdsh/cmds/modules/cp/cp.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/app/bdsh/cmds/modules/cp/cp.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -266,5 +266,7 @@
 
 		/* call copy_file and exit */
-		rc = (copy_file(src, dest_path, blen, vb) < 0);
+		if (copy_file(src, dest_path, blen, vb) < 0) {
+			rc = EIO;
+		}
 
 	} else if (src_type == TYPE_DIR) {
@@ -434,5 +436,5 @@
 	if (rc != EOK) {
 		printf("\nError copying %s: %s\n", src, str_error(rc));
-		return rc;
+		return -1;
 	}
 
@@ -442,5 +444,9 @@
 	if (buff)
 		free(buff);
-	return rc;
+	if (rc != EOK) {
+		return -1;
+	} else {
+		return 0;
+	}
 }
 
@@ -473,5 +479,5 @@
 	int force = 0, interactive = 0;
 	int c, opt_ind;
-	int64_t ret;
+	int ret;
 
 	con = console_init(stdin, stdout);
Index: uspace/app/bdsh/input.c
===================================================================
--- uspace/app/bdsh/input.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/app/bdsh/input.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -73,5 +73,5 @@
 	
 	char *cmd[WORD_MAX];
-	int rc = 0;
+	int rc = EOK;
 	tokenizer_t tok;
 	unsigned int i, pipe_count, processed_pipes;
@@ -82,5 +82,5 @@
 	if (usr->line == NULL) {
 		free(tokens_buf);
-		return CL_EFAIL;
+		return EINVAL;
 	}
 
@@ -198,5 +198,9 @@
 	}
 
-	rc = run_command(cmd, usr, &new_iostate);
+	if (run_command(cmd, usr, &new_iostate) == 0) {
+		rc = EOK;
+	} else {
+		rc = EINVAL;
+	}
 	
 finit_with_files:
Index: uspace/app/fontviewer/fontviewer.c
===================================================================
--- uspace/app/fontviewer/fontviewer.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/app/fontviewer/fontviewer.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -149,12 +149,11 @@
 	va_end(args);
 	
-	if (ret <= 0)
-		return ret;
-	
-	drawctx_set_source(drawctx, source);
-	drawctx_set_font(drawctx, font);
-	drawctx_print(drawctx, str, x, y);
-	
-	free(str);
+	if (ret >= 0) {
+		drawctx_set_source(drawctx, source);
+		drawctx_set_font(drawctx, font);
+		drawctx_print(drawctx, str, x, y);
+
+		free(str);
+	}
 	
 	return ret;
Index: uspace/app/init/init.c
===================================================================
--- uspace/app/init/init.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/app/init/init.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -208,5 +208,5 @@
 		    path, retval);
 	
-	return retval;
+	return retval == 0 ? EOK : EPARTY;
 }
 
Index: uspace/app/pkg/pkg.c
===================================================================
--- uspace/app/pkg/pkg.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/app/pkg/pkg.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -96,5 +96,5 @@
 	}
 
-	return retval;
+	return retval == 0 ? EOK : EPARTY;
 }
 
Index: uspace/app/trace/ipcp.c
===================================================================
--- uspace/app/trace/ipcp.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/app/trace/ipcp.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -281,5 +281,5 @@
 			if (oper->rv_type != V_VOID) {
 				putchar(' ');
-				val_print(retval, oper->rv_type);
+				val_print((sysarg_t) retval, oper->rv_type);
 			}
 			
Index: uspace/app/trace/trace.c
===================================================================
--- uspace/app/trace/trace.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/app/trace/trace.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -260,5 +260,5 @@
 
 
-static void print_sc_retval(int retval, val_type_t val_type)
+static void print_sc_retval(sysarg_t retval, val_type_t val_type)
 {
 	printf(" -> ");
@@ -296,13 +296,13 @@
 	IPC_SET_ARG5(call, 0);
 
-	ipcp_call_out(phoneid, &call, sc_rc);
-}
-
-static void sc_ipc_call_async_slow(sysarg_t *sc_args, sysarg_t sc_rc)
+	ipcp_call_out(phoneid, &call, 0);
+}
+
+static void sc_ipc_call_async_slow(sysarg_t *sc_args, int sc_rc)
 {
 	ipc_call_t call;
 	int rc;
 
-	if (sc_rc != (sysarg_t) EOK)
+	if (sc_rc != EOK)
 		return;
 
@@ -310,6 +310,6 @@
 	rc = udebug_mem_read(sess, &call.args, sc_args[1], sizeof(call.args));
 
-	if (rc >= 0) {
-		ipcp_call_out(sc_args[0], &call, sc_rc);
+	if (rc == EOK) {
+		ipcp_call_out(sc_args[0], &call, 0);
 	}
 }
@@ -581,5 +581,5 @@
 		
 		if (!console_get_event(console, &event))
-			return -1;
+			return EINVAL;
 		
 		if (event.type == CEV_KEY) {
Index: uspace/drv/platform/msim/msim.c
===================================================================
--- uspace/drv/platform/msim/msim.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/drv/platform/msim/msim.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -156,5 +156,5 @@
 	/* Nothing to do. */
 
-	return true;
+	return EOK;
 }
 
Index: uspace/drv/platform/sun4v/sun4v.c
===================================================================
--- uspace/drv/platform/sun4v/sun4v.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/drv/platform/sun4v/sun4v.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -116,5 +116,5 @@
 static int sun4v_enable_interrupt(ddf_fun_t *fun, int irq)
 {
-	return true;
+	return EOK;
 }
 
Index: uspace/lib/c/include/io/klog.h
===================================================================
--- uspace/lib/c/include/io/klog.h	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/lib/c/include/io/klog.h	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -49,10 +49,10 @@
 #define KLOG_PRINTF(lvl, fmt, ...) ({ \
 	char *_s; \
-	int _c = asprintf(&_s, fmt, ##__VA_ARGS__); \
-	if (_c >= 0) { \
-		_c = klog_write((lvl), _s, str_size(_s)); \
+	int _rc = ENOMEM; \
+	if (asprintf(&_s, fmt, ##__VA_ARGS__) >= 0) { \
+		_rc = klog_write((lvl), _s, str_size(_s)); \
 		free(_s); \
 	}; \
-	(_c >= 0); \
+	(_rc != EOK); \
 })
 
Index: uspace/lib/http/src/request.c
===================================================================
--- uspace/lib/http/src/request.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/lib/http/src/request.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -96,5 +96,5 @@
 	ssize_t meth_size = http_encode_method(NULL, 0, req->method, req->path);
 	if (meth_size < 0)
-		return meth_size;
+		return EINVAL;
 	size_t size = meth_size;
 	
@@ -102,5 +102,5 @@
 		ssize_t header_size = http_header_encode(header, NULL, 0);
 		if (header_size < 0)
-			return header_size;
+			return EINVAL;
 		size += header_size;
 	}
@@ -116,5 +116,5 @@
 	if (written < 0) {
 		free(buf);
-		return written;
+		return EINVAL;
 	}
 	pos += written;
@@ -125,5 +125,5 @@
 		if (written < 0) {
 			free(buf);
-			return written;
+			return EINVAL;
 		}
 		pos += written;
Index: uspace/lib/usbdev/src/recognise.c
===================================================================
--- uspace/lib/usbdev/src/recognise.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/lib/usbdev/src/recognise.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -88,10 +88,12 @@
 		char *str = NULL; \
 		int __rc = asprintf(&str, format, ##__VA_ARGS__); \
-		if (__rc > 0) { \
-			__rc = usb_add_match_id((match_ids), (score), str); \
-		} \
-		if (__rc != EOK) { \
-			free(str); \
-			return __rc; \
+		if (__rc >= 0) { \
+			int __rc = usb_add_match_id((match_ids), (score), str); \
+			if (__rc != EOK) { \
+				free(str); \
+				return __rc; \
+			} \
+		} else { \
+			return ENOMEM; \
 		} \
 	} while (0)
Index: uspace/srv/devman/devtree.c
===================================================================
--- uspace/srv/devman/devtree.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/srv/devman/devtree.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -198,5 +198,5 @@
 	dev_node_t *rdev = tree->root_node->child;
 	dev_add_ref(rdev);
-	int rc = assign_driver(rdev, drivers_list, tree);
+	bool rc = assign_driver(rdev, drivers_list, tree);
 	dev_del_ref(rdev);
 	
Index: uspace/srv/fs/mfs/mfs.c
===================================================================
--- uspace/srv/fs/mfs/mfs.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/srv/fs/mfs/mfs.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -68,5 +68,5 @@
 		else {
 			printf(NAME " Unrecognized parameters");
-			rc = -1;
+			rc = EINVAL;
 			goto err;
 		}
@@ -78,5 +78,6 @@
 	if (!vfs_sess) {
 		printf(NAME ": failed to connect to VFS\n");
-		return -1;
+		rc = errno;
+		goto err;
 	}
 
Index: uspace/srv/fs/mfs/mfs_balloc.c
===================================================================
--- uspace/srv/fs/mfs/mfs_balloc.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/srv/fs/mfs/mfs_balloc.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -246,5 +246,5 @@
 			printf(NAME ": Error! Trying to free beyond the "
 			    "bitmap max size\n");
-			return -1;
+			return EIO;
 		}
 	} else {
@@ -254,5 +254,5 @@
 			printf(NAME ": Error! Trying to free beyond the "
 			    "bitmap max size\n");
-			return -1;
+			return EIO;
 		}
 	}
@@ -303,5 +303,6 @@
 	unsigned *search, i, start_block;
 	unsigned bits_per_block;
-	int r, freebit;
+	int r;
+	int freebit;
 
 	sbi = inst->sbi;
Index: uspace/srv/hid/input/ctl/stty.c
===================================================================
--- uspace/srv/hid/input/ctl/stty.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/srv/hid/input/ctl/stty.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -243,5 +243,8 @@
 
 	gsp_init(&sp);
-	return gsp_insert_defs(&sp, seq_defs);
+	if (gsp_insert_defs(&sp, seq_defs) < 0) {
+		return EINVAL;
+	}
+	return EOK;
 }
 
Index: uspace/srv/hid/rfb/rfb.c
===================================================================
--- uspace/srv/hid/rfb/rfb.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/srv/hid/rfb/rfb.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -435,5 +435,5 @@
 }
 
-static size_t rfb_tile_encode_solid(rfb_t *rfb, cpixel_ctx_t *cpixel,
+static int rfb_tile_encode_solid(rfb_t *rfb, cpixel_ctx_t *cpixel,
     rfb_rectangle_t *tile, void *buf, size_t *size)
 {
Index: uspace/srv/loader/main.c
===================================================================
--- uspace/srv/loader/main.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/srv/loader/main.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -300,5 +300,5 @@
 	pcb.inbox_entries = inbox_entries;
 	
-	async_answer_0(rid, rc);
+	async_answer_0(rid, EOK);
 	return 0;
 }
Index: uspace/srv/volsrv/mkfs.c
===================================================================
--- uspace/srv/volsrv/mkfs.c	(revision a1026daf544b91d3c8e6d81817113aece3c7440e)
+++ uspace/srv/volsrv/mkfs.c	(revision 1569a9b70f7219a7103788305e4baf473da24376)
@@ -98,5 +98,5 @@
 	}
 
-	return retval;
+	return retval == 0 ? EOK : EPARTY;
 }
 
