Index: tools/autotool.py
===================================================================
--- tools/autotool.py	(revision 1412b7ee6b7f425f83228a640c7fc6be60aa22a3)
+++ tools/autotool.py	(revision 680708de84f2c29a119bfe0135b7e5ba3ac55860)
@@ -790,5 +790,5 @@
 		
 		if (config['COMPILER'] == "clang"):
-			target, cc_args, gnu_target, clang_target, helenos_target = get_target(config)
+			target, cc_args, gnu_target, clang_target = get_target(config)
 			
 			if (target is None) or (gnu_target is None) or (clang_target is None):
Index: uspace/lib/ext4/libext4_balloc.c
===================================================================
--- uspace/lib/ext4/libext4_balloc.c	(revision 1412b7ee6b7f425f83228a640c7fc6be60aa22a3)
+++ uspace/lib/ext4/libext4_balloc.c	(revision 680708de84f2c29a119bfe0135b7e5ba3ac55860)
@@ -91,8 +91,6 @@
 	block_t *bitmap_block;
 	rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
-	if (rc != EOK) {
-		ext4_filesystem_put_block_group_ref(bg_ref);
-		return rc;
-	}
+	if (rc != EOK)
+		return rc;
 	
 	/* Modify bitmap */
@@ -132,5 +130,9 @@
 	
 	/* Release block group reference */
-	return ext4_filesystem_put_block_group_ref(bg_ref);
+	rc = ext4_filesystem_put_block_group_ref(bg_ref);
+	if (rc != EOK)
+		return rc;
+	
+	return EOK;
 }
 
@@ -171,8 +173,6 @@
 	block_t *bitmap_block;
 	rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
-	if (rc != EOK) {
-		ext4_filesystem_put_block_group_ref(bg_ref);
-		return rc;
-	}
+	if (rc != EOK)
+		return rc;
 	
 	/* Modify bitmap */
@@ -212,5 +212,9 @@
 	
 	/* Release block group reference */
-	return ext4_filesystem_put_block_group_ref(bg_ref);
+	rc = ext4_filesystem_put_block_group_ref(bg_ref);
+	if (rc != EOK)
+		return rc;
+	
+	return EOK;
 }
 
@@ -260,7 +264,8 @@
  *
  */
-static int ext4_balloc_find_goal(ext4_inode_ref_t *inode_ref, uint32_t *goal)
+static uint32_t ext4_balloc_find_goal(ext4_inode_ref_t *inode_ref)
 {
-	*goal = 0;
+	uint32_t goal = 0;
+	
 	ext4_superblock_t *sb = inode_ref->fs->superblock;
 	
@@ -275,11 +280,11 @@
 	if (inode_block_count > 0) {
 		int rc = ext4_filesystem_get_inode_data_block_index(inode_ref,
-		    inode_block_count - 1, goal);
+		    inode_block_count - 1, &goal);
 		if (rc != EOK)
-			return rc;
+			return 0;
 		
 		if (goal != 0) {
-			(*goal)++;
-			return EOK;
+			goal++;
+			return goal;
 		}
 		
@@ -297,5 +302,5 @@
 	    block_group, &bg_ref);
 	if (rc != EOK)
-		return rc;
+		return 0;
 	
 	/* Compute indexes */
@@ -322,7 +327,9 @@
 		inode_table_blocks++;
 	
-	*goal = inode_table_first_block + inode_table_blocks;
-	
-	return ext4_filesystem_put_block_group_ref(bg_ref);
+	goal = inode_table_first_block + inode_table_blocks;
+	
+	ext4_filesystem_put_block_group_ref(bg_ref);
+	
+	return goal;
 }
 
@@ -342,13 +349,10 @@
 	block_t *bitmap_block;
 	uint32_t rel_block_idx = 0;
-	uint32_t goal;
 	
 	/* Find GOAL */
-	int rc = ext4_balloc_find_goal(inode_ref, &goal);
-	if (rc != EOK)
-		return rc;
-	else if (goal == 0) {
+	uint32_t goal = ext4_balloc_find_goal(inode_ref);
+	if (goal == 0) {
 		/* no goal found => partition is full */
-		return ENOMEM;
+		return ENOSPC;
 	}
 	
@@ -362,5 +366,5 @@
 	/* Load block group reference */
 	ext4_block_group_ref_t *bg_ref;
-	rc = ext4_filesystem_get_block_group_ref(inode_ref->fs,
+	int rc = ext4_filesystem_get_block_group_ref(inode_ref->fs,
 	    block_group, &bg_ref);
 	if (rc != EOK)
@@ -463,13 +467,6 @@
 	
 	/* No free block found yet */
-	rc = block_put(bitmap_block);
-	if (rc != EOK) {
-		ext4_filesystem_put_block_group_ref(bg_ref);
-		return rc;
-	}
-
-	rc = ext4_filesystem_put_block_group_ref(bg_ref);
-	if (rc != EOK)
-		return rc;
+	block_put(bitmap_block);
+	ext4_filesystem_put_block_group_ref(bg_ref);
 	
 	/* Try other block groups */
@@ -515,8 +512,6 @@
 			bitmap_block->dirty = true;
 			rc = block_put(bitmap_block);
-			if (rc != EOK) {
-				ext4_filesystem_put_block_group_ref(bg_ref);
+			if (rc != EOK)
 				return rc;
-			}
 			
 			allocated_block =
@@ -533,8 +528,6 @@
 			bitmap_block->dirty = true;
 			rc = block_put(bitmap_block);
-			if (rc != EOK) {
-				ext4_filesystem_put_block_group_ref(bg_ref);
+			if (rc != EOK)
 				return rc;
-			}
 			
 			allocated_block =
@@ -545,13 +538,6 @@
 		}
 		
-		rc = block_put(bitmap_block);
-		if (rc != EOK) {
-			ext4_filesystem_put_block_group_ref(bg_ref);
-			return rc;
-		}
-
-		rc = ext4_filesystem_put_block_group_ref(bg_ref);
-		if (rc != EOK)
-			return rc;
+		block_put(bitmap_block);
+		ext4_filesystem_put_block_group_ref(bg_ref);
 		
 		/* Goto next group */
@@ -588,8 +574,8 @@
 	bg_ref->dirty = true;
 	
-	rc = ext4_filesystem_put_block_group_ref(bg_ref);
+	ext4_filesystem_put_block_group_ref(bg_ref);
 	
 	*fblock = allocated_block;
-	return rc;
+	return EOK;
 }
 
@@ -606,5 +592,5 @@
     bool *free)
 {
-	int rc;
+	int rc = EOK;
 	
 	ext4_filesystem_t *fs = inode_ref->fs;
@@ -627,8 +613,6 @@
 	block_t *bitmap_block;
 	rc = block_get(&bitmap_block, fs->device, bitmap_block_addr, 0);
-	if (rc != EOK) {
-		ext4_filesystem_put_block_group_ref(bg_ref);
-		return rc;
-	}
+	if (rc != EOK)
+		return rc;
 	
 	/* Check if block is free */
Index: uspace/lib/ext4/libext4_directory_index.c
===================================================================
--- uspace/lib/ext4/libext4_directory_index.c	(revision 1412b7ee6b7f425f83228a640c7fc6be60aa22a3)
+++ uspace/lib/ext4/libext4_directory_index.c	(revision 680708de84f2c29a119bfe0135b7e5ba3ac55860)
@@ -527,7 +527,5 @@
 		
 		/* Don't forget to put old block (prevent memory leak) */
-		rc = block_put(p->block);
-		if (rc != EOK)
-			return rc;
+		block_put(p->block);
 		
 		p->block = block;
@@ -555,5 +553,4 @@
 	/* Load direct block 0 (index root) */
 	uint32_t root_block_addr;
-	int rc2;
 	int rc = ext4_filesystem_get_inode_data_block_index(inode_ref, 0,
 	    &root_block_addr);
@@ -623,7 +620,5 @@
 		
 		/* Not found, leave untouched */
-		rc2 = block_put(leaf_block);
-		if (rc2 != EOK)
-			goto cleanup;
+		block_put(leaf_block);
 		
 		if (rc != ENOENT)
@@ -633,7 +628,6 @@
 		rc = ext4_directory_dx_next_block(inode_ref, hinfo.hash,
 		    dx_block, &dx_blocks[0]);
-		if (rc != EOK)
+		if (rc < 0)
 			goto cleanup;
-
 	} while (rc == ENOENT);
 	
@@ -646,7 +640,5 @@
 	
 	while (tmp <= dx_block) {
-		rc2 = block_put(tmp->block);
-		if (rc == EOK && rc2 != EOK)
-			rc = rc2;
+		block_put(tmp->block);
 		++tmp;
 	}
Index: uspace/lib/ext4/libext4_extent.c
===================================================================
--- uspace/lib/ext4/libext4_extent.c	(revision 1412b7ee6b7f425f83228a640c7fc6be60aa22a3)
+++ uspace/lib/ext4/libext4_extent.c	(revision 680708de84f2c29a119bfe0135b7e5ba3ac55860)
@@ -371,5 +371,4 @@
     uint32_t *fblock)
 {
-	int rc;
 	/* Compute bound defined by i-node size */
 	uint64_t inode_size =
@@ -401,11 +400,8 @@
 		uint64_t child = ext4_extent_index_get_leaf(index);
 		
-		if (block != NULL) {
-			rc = block_put(block);
-			if (rc != EOK)
-				return rc;
-		}
-		
-		rc = block_get(&block, inode_ref->fs->device, child,
+		if (block != NULL)
+			block_put(block);
+		
+		int rc = block_get(&block, inode_ref->fs->device, child,
 		    BLOCK_FLAGS_NONE);
 		if (rc != EOK)
@@ -433,7 +429,7 @@
 	/* Cleanup */
 	if (block != NULL)
-		rc = block_put(block);
-	
-	return rc;
+		block_put(block);
+	
+	return EOK;
 }
 
@@ -509,8 +505,4 @@
 	
 cleanup:
-	;
-
-	int rc2 = EOK;
-
 	/*
 	 * Put loaded blocks
@@ -518,9 +510,6 @@
 	 */
 	for (uint16_t i = 1; i < tmp_path->depth; ++i) {
-		if (tmp_path[i].block) {
-			rc2 = block_put(tmp_path[i].block);
-			if (rc == EOK && rc2 != EOK)
-				rc = rc2;
-		}
+		if (tmp_path[i].block)
+			block_put(tmp_path[i].block);
 	}
 	
@@ -605,5 +594,7 @@
 		return rc;
 	
-	return ext4_balloc_free_block(inode_ref, fblock);
+	ext4_balloc_free_block(inode_ref, fblock);
+	
+	return EOK;
 }
 
@@ -730,8 +721,4 @@
 	
 cleanup:
-	;
-
-	int rc2 = EOK;
-
 	/*
 	 * Put loaded blocks
@@ -739,9 +726,6 @@
 	 */
 	for (uint16_t i = 1; i <= path->depth; ++i) {
-		if (path[i].block) {
-			rc2 = block_put(path[i].block);
-			if (rc == EOK && rc2 != EOK)
-				rc = rc2;
-		}
+		if (path[i].block)
+			block_put(path[i].block);
 	}
 	
@@ -794,9 +778,5 @@
 			
 			/* Put back not modified old block */
-			rc = block_put(path_ptr->block);
-			if (rc != EOK) {
-				ext4_balloc_free_block(inode_ref, fblock);
-				return rc;
-			}
+			block_put(path_ptr->block);
 			
 			/* Initialize newly allocated block and remember it */
@@ -1081,8 +1061,4 @@
 	
 finish:
-	;
-
-	int rc2 = EOK;
-
 	/* Set return values */
 	*iblock = new_block_idx;
@@ -1094,9 +1070,6 @@
 	 */
 	for (uint16_t i = 1; i <= path->depth; ++i) {
-		if (path[i].block) {
-			rc2 = block_put(path[i].block);
-			if (rc == EOK && rc2 != EOK)
-				rc = rc2;
-		}
+		if (path[i].block)
+			block_put(path[i].block);
 	}
 	
Index: uspace/lib/ext4/libext4_filesystem.c
===================================================================
--- uspace/lib/ext4/libext4_filesystem.c	(revision 1412b7ee6b7f425f83228a640c7fc6be60aa22a3)
+++ uspace/lib/ext4/libext4_filesystem.c	(revision 680708de84f2c29a119bfe0135b7e5ba3ac55860)
@@ -797,8 +797,5 @@
 		}
 		
-		rc = block_put(block);
-		if (rc != EOK)
-			return rc;
-
+		block_put(block);
 		rc = ext4_balloc_free_block(inode_ref, fblock);
 		if (rc != EOK)
@@ -844,7 +841,5 @@
 				}
 				
-				rc = block_put(subblock);
-				if (rc != EOK)
-					return rc;
+				block_put(subblock);
 			}
 			
@@ -856,8 +851,5 @@
 		}
 		
-		rc = block_put(block);
-		if (rc != EOK)
-			return rc;
-
+		block_put(block);
 		rc = ext4_balloc_free_block(inode_ref, fblock);
 		if (rc != EOK)
Index: uspace/lib/ext4/libext4_ialloc.c
===================================================================
--- uspace/lib/ext4/libext4_ialloc.c	(revision 1412b7ee6b7f425f83228a640c7fc6be60aa22a3)
+++ uspace/lib/ext4/libext4_ialloc.c	(revision 680708de84f2c29a119bfe0135b7e5ba3ac55860)
@@ -204,8 +204,6 @@
 			rc = block_get(&bitmap_block, fs->device, bitmap_block_addr,
 			    BLOCK_FLAGS_NONE);
-			if (rc != EOK) {
-				ext4_filesystem_put_block_group_ref(bg_ref);
+			if (rc != EOK)
 				return rc;
-			}
 			
 			/* Try to allocate i-node in the bitmap */
@@ -217,15 +215,6 @@
 			/* Block group has not any free i-node */
 			if (rc == ENOSPC) {
-				rc = block_put(bitmap_block);
-				if (rc != EOK) {
-					ext4_filesystem_put_block_group_ref(bg_ref);
-					return rc;
-				}
-
-				rc = ext4_filesystem_put_block_group_ref(bg_ref);
-				if (rc != EOK)
-					return rc;
-
-				bgid++;
+				block_put(bitmap_block);
+				ext4_filesystem_put_block_group_ref(bg_ref);
 				continue;
 			}
@@ -235,8 +224,6 @@
 			
 			rc = block_put(bitmap_block);
-			if (rc != EOK) {
-				ext4_filesystem_put_block_group_ref(bg_ref);
+			if (rc != EOK)
 				return rc;
-			}
 			
 			/* Modify filesystem counters */
@@ -285,8 +272,5 @@
 		
 		/* Block group not modified, put it and jump to the next block group */
-		rc = ext4_filesystem_put_block_group_ref(bg_ref);
-		if (rc != EOK)
-			return rc;
-
+		ext4_filesystem_put_block_group_ref(bg_ref);
 		++bgid;
 	}
Index: uspace/srv/fs/ext4fs/ext4fs_ops.c
===================================================================
--- uspace/srv/fs/ext4fs/ext4fs_ops.c	(revision 1412b7ee6b7f425f83228a640c7fc6be60aa22a3)
+++ uspace/srv/fs/ext4fs/ext4fs_ops.c	(revision 680708de84f2c29a119bfe0135b7e5ba3ac55860)
@@ -259,12 +259,8 @@
 	rc = ext4fs_node_get_core(rfn, eparent->instance, inode);
 	if (rc != EOK)
-		goto exit;
-
-exit:
-	;
-
+		return rc;
+	
 	/* Destroy search result structure */
-	int const rc2 = ext4_directory_destroy_result(&result);
-	return rc == EOK ? rc2 : rc;
+	return ext4_directory_destroy_result(&result);
 }
 
@@ -1006,5 +1002,7 @@
 	*lnkcnt = 1;
 	
-	return ext4fs_node_put(root_node);
+	ext4fs_node_put(root_node);
+	
+	return EOK;
 }
 
@@ -1095,7 +1093,7 @@
 	}
 	
-	int const rc2 = ext4_filesystem_put_inode_ref(inode_ref);
-	
-	return rc == EOK ? rc2 : rc;
+	ext4_filesystem_put_inode_ref(inode_ref);
+	
+	return rc;
 }
 
@@ -1270,9 +1268,9 @@
 		memset(buffer, 0, bytes);
 		
-		rc = async_data_read_finalize(callid, buffer, bytes);
+		async_data_read_finalize(callid, buffer, bytes);
 		*rbytes = bytes;
 		
 		free(buffer);
-		return rc;
+		return EOK;
 	}
 	
@@ -1286,9 +1284,5 @@
 	
 	assert(offset_in_block + bytes <= block_size);
-	rc = async_data_read_finalize(callid, block->data + offset_in_block, bytes);
-	if (rc != EOK) {
-		block_put(block);
-		return rc;
-	}
+	async_data_read_finalize(callid, block->data + offset_in_block, bytes);
 	
 	rc = block_put(block);
@@ -1322,7 +1316,7 @@
 	size_t len;
 	if (!async_data_write_receive(&callid, &len)) {
-		rc = EINVAL;
-		async_answer_0(callid, rc);
-		goto exit;
+		ext4fs_node_put(fn);
+		async_answer_0(callid, EINVAL);
+		return EINVAL;
 	}
 	
@@ -1347,6 +1341,7 @@
 	    &fblock);
 	if (rc != EOK) {
+		ext4fs_node_put(fn);
 		async_answer_0(callid, rc);
-		goto exit;
+		return rc;
 	}
 	
@@ -1364,6 +1359,7 @@
 				    &fblock, true);
 				if (rc != EOK) {
+					ext4fs_node_put(fn);
 					async_answer_0(callid, rc);
-					goto exit;
+					return rc;
 				}
 			}
@@ -1372,12 +1368,14 @@
 			    &fblock, false);
 			if (rc != EOK) {
+				ext4fs_node_put(fn);
 				async_answer_0(callid, rc);
-				goto exit;
+				return rc;
 			}
 		} else {
 			rc = ext4_balloc_alloc_block(inode_ref, &fblock);
 			if (rc != EOK) {
+				ext4fs_node_put(fn);
 				async_answer_0(callid, rc);
-				goto exit;
+				return rc;
 			}
 			
@@ -1386,6 +1384,7 @@
 			if (rc != EOK) {
 				ext4_balloc_free_block(inode_ref, fblock);
+				ext4fs_node_put(fn);
 				async_answer_0(callid, rc);
-				goto exit;
+				return rc;
 			}
 		}
@@ -1399,24 +1398,27 @@
 	rc = block_get(&write_block, service_id, fblock, flags);
 	if (rc != EOK) {
+		ext4fs_node_put(fn);
 		async_answer_0(callid, rc);
-		goto exit;
-	}
-	
-	if (flags == BLOCK_FLAGS_NOREAD) {
+		return rc;
+	}
+	
+	if (flags == BLOCK_FLAGS_NOREAD)
 		memset(write_block->data, 0, block_size);
-		write_block->dirty = true;
-	}
-
+	
 	rc = async_data_write_finalize(callid, write_block->data +
 	    (pos % block_size), bytes);
 	if (rc != EOK) {
-		block_put(write_block);
-		goto exit;
-	}
-
+		ext4fs_node_put(fn);
+		return rc;
+	}
+	
+	write_block->dirty = true;
+	
 	rc = block_put(write_block);
-	if (rc != EOK)
-		goto exit;
-
+	if (rc != EOK) {
+		ext4fs_node_put(fn);
+		return rc;
+	}
+	
 	/* Do some counting */
 	uint32_t old_inode_size = ext4_inode_get_size(fs->superblock,
@@ -1426,13 +1428,9 @@
 		inode_ref->dirty = true;
 	}
-
+	
 	*nsize = ext4_inode_get_size(fs->superblock, inode_ref->inode);
 	*wbytes = bytes;
-
-exit:
-	;
-
-	int const rc2 = ext4fs_node_put(fn);
-	return rc == EOK ? rc2 : rc;
+	
+	return ext4fs_node_put(fn);
 }
 
@@ -1460,7 +1458,7 @@
 	
 	rc = ext4_filesystem_truncate_inode(inode_ref, new_size);
-	int const rc2 = ext4fs_node_put(fn);
-	
-	return rc == EOK ? rc2 : rc;
+	ext4fs_node_put(fn);
+	
+	return rc;
 }
 
