Better retirement and erasure checking.
[yaffs2.git] / yaffs_mtdif2.c
index 83194814d0b5f06f64d3d06f9f49563f1a792000..1b917be0ff6f4c289a2298fb0ab51b9c344c301a 100644 (file)
@@ -16,7 +16,7 @@
 /* mtd interface for YAFFS2 */
 
 const char *yaffs_mtdif2_c_version =
-    "$Id: yaffs_mtdif2.c,v 1.9 2005-12-07 21:49:18 charles Exp $";
+    "$Id: yaffs_mtdif2.c,v 1.12 2006-09-21 08:13:59 charles Exp $";
 
 #include "yportenv.h"
 
@@ -90,11 +90,10 @@ int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
 
        T(YAFFS_TRACE_MTD,
          (TSTR
-          ("nandmtd2_ReadChunkWithTagsToNAND chunk %d data %p tags %p"
+          ("nandmtd2_ReadChunkWithTagsFromNAND chunk %d data %p tags %p"
            TENDSTR), chunkInNAND, data, tags));
 
-       if (1 ||  /* Always do this */
-           data && tags) {
+       if (data && tags) {
                if (dev->useNANDECC) {
                        retval =
                            mtd->read_ecc(mtd, addr, dev->nBytesPerChunk,
@@ -121,6 +120,9 @@ int nandmtd2_ReadChunkWithTagsFromNAND(yaffs_Device * dev, int chunkInNAND,
 
        if (tags)
                yaffs_UnpackTags2(tags, &pt);
+       
+       if(tags && retval == -EBADMSG && tags->eccResult == YAFFS_ECC_RESULT_NO_ERROR)
+               tags->eccResult = YAFFS_ECC_RESULT_UNFIXED;
 
        if (retval == 0)
                return YAFFS_OK;