fixes the offset calculation for mtd->block_markbad and mtd->block_isbad --- yaffs_mtdif2_multi.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/yaffs_mtdif2_multi.c b/yaffs_mtdif2_multi.c index 684ed2a..9d18d0e 100644 --- a/yaffs_mtdif2_multi.c +++ b/yaffs_mtdif2_multi.c @@ -204,14 +204,14 @@ int nandmtd2_mark_block_bad(struct yaffs_dev *dev, int block_no) { struct mtd_info *mtd = yaffs_dev_to_mtd(dev); int retval; + loff_t offsaddr = (((loff_t) block_no) * dev->param.chunks_per_block* dev->param.total_bytes_per_chunk); yaffs_trace(YAFFS_TRACE_MTD, "nandmtd2_mark_block_bad %d", block_no); retval = mtd->block_markbad(mtd, - block_no * dev->param.chunks_per_block * - dev->param.total_bytes_per_chunk); + offsaddr); if (retval == 0) return YAFFS_OK; @@ -225,12 +225,11 @@ int nandmtd2_query_block(struct yaffs_dev *dev, int block_no, { struct mtd_info *mtd = yaffs_dev_to_mtd(dev); int retval; - + loff_t offsaddr = (((loff_t) block_no) * dev->param.chunks_per_block* dev->param.total_bytes_per_chunk); yaffs_trace(YAFFS_TRACE_MTD, "nandmtd2_query_block %d", block_no); retval = mtd->block_isbad(mtd, - block_no * dev->param.chunks_per_block * - dev->param.total_bytes_per_chunk); + offsaddr); if (retval) { yaffs_trace(YAFFS_TRACE_MTD, "block is bad"); -- 1.7.0.4