Index: uspace/srv/fs/fat/fat.h
===================================================================
--- uspace/srv/fs/fat/fat.h	(revision 0fc1e5d76be00c32f5334cd23903352fdd5fd5bf)
+++ uspace/srv/fs/fat/fat.h	(revision 9a15176934d30314b2ac25717713bdcf2bca7479)
@@ -215,5 +215,5 @@
 extern void fat_sync(ipc_callid_t, ipc_call_t *);
 
-extern fat_idx_t *fat_idx_get_new(dev_handle_t);
+extern int fat_idx_get_new(fat_idx_t **, dev_handle_t);
 extern fat_idx_t *fat_idx_get_by_pos(dev_handle_t, fat_cluster_t, unsigned);
 extern fat_idx_t *fat_idx_get_by_index(dev_handle_t, fs_index_t);
Index: uspace/srv/fs/fat/fat_idx.c
===================================================================
--- uspace/srv/fs/fat/fat_idx.c	(revision 0fc1e5d76be00c32f5334cd23903352fdd5fd5bf)
+++ uspace/srv/fs/fat/fat_idx.c	(revision 9a15176934d30314b2ac25717713bdcf2bca7479)
@@ -339,5 +339,5 @@
 }
 
-static fat_idx_t *fat_idx_create(dev_handle_t dev_handle)
+static int fat_idx_create(fat_idx_t **fidxp, dev_handle_t dev_handle)
 {
 	fat_idx_t *fidx;
@@ -345,8 +345,8 @@
 	fidx = (fat_idx_t *) malloc(sizeof(fat_idx_t));
 	if (!fidx) 
-		return NULL;
+		return ENOMEM;
 	if (!fat_index_alloc(dev_handle, &fidx->index)) {
 		free(fidx);
-		return NULL;
+		return ENOSPC;
 	}
 		
@@ -359,16 +359,18 @@
 	fidx->nodep = NULL;
 
-	return fidx;
-}
-
-fat_idx_t *fat_idx_get_new(dev_handle_t dev_handle)
+	*fidxp = fidx;
+	return EOK;
+}
+
+int fat_idx_get_new(fat_idx_t **fidxp, dev_handle_t dev_handle)
 {
 	fat_idx_t *fidx;
+	int rc;
 
 	fibril_mutex_lock(&used_lock);
-	fidx = fat_idx_create(dev_handle);
-	if (!fidx) {
+	rc = fat_idx_create(&fidx, dev_handle);
+	if (rc != EOK) {
 		fibril_mutex_unlock(&used_lock);
-		return NULL;
+		return rc;
 	}
 		
@@ -382,5 +384,6 @@
 	fibril_mutex_unlock(&used_lock);
 
-	return fidx;
+	*fidxp = fidx;
+	return EOK;
 }
 
@@ -401,6 +404,8 @@
 		fidx = hash_table_get_instance(l, fat_idx_t, uph_link);
 	} else {
-		fidx = fat_idx_create(dev_handle);
-		if (!fidx) {
+		int rc;
+
+		rc = fat_idx_create(&fidx, dev_handle);
+		if (rc != EOK) {
 			fibril_mutex_unlock(&used_lock);
 			return NULL;
Index: uspace/srv/fs/fat/fat_ops.c
===================================================================
--- uspace/srv/fs/fat/fat_ops.c	(revision 0fc1e5d76be00c32f5334cd23903352fdd5fd5bf)
+++ uspace/srv/fs/fat/fat_ops.c	(revision 9a15176934d30314b2ac25717713bdcf2bca7479)
@@ -462,9 +462,9 @@
 		return rc;
 	}
-	idxp = fat_idx_get_new(dev_handle);
-	if (!idxp) {
+	rc = fat_idx_get_new(&idxp, dev_handle);
+	if (rc != EOK) {
 		(void) fat_free_clusters(bs, dev_handle, mcl);	
 		(void) fat_node_put(FS_NODE(nodep));
-		return ENOMEM;	/* FIXME: determine the true error code */
+		return rc;
 	}
 	/* idxp->lock held */
