changeset 197:43f352d1d160

Fix bad-block status during query. Mtd read does not indicate bad-block status (reported by list subscriber "thisway.diy").
author imcd
date Mon, 01 Oct 2007 20:40:33 +0100
parents 1ed7a7549e0a
children d26c7ca13430
files yaffs_mtdif1.c
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/yaffs_mtdif1.c
+++ b/yaffs_mtdif1.c
@@ -327,6 +327,7 @@ int nandmtd1_QueryNANDBlock(struct yaffs
 {
 	struct mtd_info * mtd = dev->genericDevice;
 	int chunkNo = blockNo * dev->nChunksPerBlock;
+	loff_t addr = (loff_t)chunkNo * dev->nDataBytesPerChunk;
 	yaffs_ExtendedTags etags;
 	int state = YAFFS_BLOCK_STATE_DEAD;
 	int seqnum = 0;
@@ -340,6 +341,7 @@ int nandmtd1_QueryNANDBlock(struct yaffs
 	}
 
 	retval = nandmtd1_ReadChunkWithTagsFromNAND(dev, chunkNo, NULL, &etags);
+	etags.blockBad = (mtd->block_isbad)(mtd, addr);
 	if (etags.blockBad) {
 		yaffs_trace(YAFFS_TRACE_BAD_BLOCKS,
 			"block %d is marked bad", blockNo);