Merge branch 'time_upgrade'
[yaffs2.git] / yaffs_guts.c
index ba7fc845812a62e73abc6348a6e7661e1180316b..c05aee0c8bf8340c751c525c3944242edd0df804 100644 (file)
@@ -3017,8 +3017,10 @@ static void yaffs_check_obj_details_loaded(struct yaffs_obj *in)
 
        result = yaffs_rd_chunk_tags_nand(dev, in->hdr_chunk, buf, &tags);
 
-       if (result == YAFFS_FAIL)
+       if (result == YAFFS_FAIL) {
+               yaffs_release_temp_buffer(dev, buf);
                return;
+       }
 
        oh = (struct yaffs_obj_hdr *)buf;
 
@@ -3201,7 +3203,6 @@ int yaffs_update_oh(struct yaffs_obj *in, const YCHAR *name, int force,
                bi->has_shrink_hdr = 1;
        }
 
-
        return new_chunk_id;
 }
 
@@ -4541,11 +4542,16 @@ int yaffs_guts_ll_init(struct yaffs_dev *dev)
                return YAFFS_FAIL;
        }
 
+       if (!yaffs_init_tmp_buffers(dev))
+               return YAFFS_FAIL;
+
        if (yaffs_init_nand(dev) != YAFFS_OK) {
                yaffs_trace(YAFFS_TRACE_ALWAYS, "InitialiseNAND failed");
                return YAFFS_FAIL;
        }
 
+       dev->ll_init = 1;
+
        return YAFFS_OK;
 }
 
@@ -4692,10 +4698,7 @@ int yaffs_guts_initialise(struct yaffs_dev *dev)
 
        yaffs_endian_config(dev);
 
-       /* Initialise temporary buffers and caches. */
-       if (!yaffs_init_tmp_buffers(dev))
-               init_failed = 1;
-
+       /* Initialise temporary caches. */
        dev->gc_cleanup_list = NULL;
 
        if (!init_failed)
@@ -4824,6 +4827,7 @@ void yaffs_deinitialise(struct yaffs_dev *dev)
                kfree(dev->checkpt_block_list);
                dev->checkpt_block_list = NULL;
 
+               dev->ll_init = 0;
                dev->is_mounted = 0;
 
                yaffs_deinit_nand(dev);