Hi,

I refer to the nand driver code in the git and wishes to report some bugs.

1) nand erase <start> <end>
The erase operation terminates if a bad block is encountered. It should be

int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbbt)
{
....
        while (len) {
#ifndef NAND_ALLOW_ERASE_ALL
                /* Check if we have a bad block, we do not erase bad blocks ! */
                if (nand_block_checkbad(mtd, ((loff_t) page) << this->page_shift, 0, allowbbt)) {
#if 0
                        printk (KERN_WARNING "nand_erase: attempt to erase a bad block at address 0x%08x\n", page * mtd->oobblock);
                        instr->state = MTD_ERASE_FAILED;
                        goto erase_exit;
#else
                        /* bad block; ignore */
                        page += pages_per_block;
                        len -= (1 << this->phys_erase_shift);
                        continue;
#endif
                }
#endif

2) nand_write_ecc and/or nand_write_page writes to the nand flash without checking if the block is bad. I believe that in the linux kernel, this checking is taken care of in the fs layer (jffs2/yaffs).

Regards,
Terence.