]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/mtd/nand/nand_bbt.c
MTD/JFFS2: remove CVS keywords
[linux-2.6-omap-h63xx.git] / drivers / mtd / nand / nand_bbt.c
index a612c4ea8194d86750c39d0aac18784cbfe20606..0b1c48595f1255547aea9eae6e41ba03e47dc05f 100644 (file)
@@ -6,8 +6,6 @@
  *
  *  Copyright (C) 2004 Thomas Gleixner (tglx@linutronix.de)
  *
- * $Id: nand_bbt.c,v 1.36 2005/11/07 11:14:30 gleixner Exp $
- *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
@@ -333,7 +331,6 @@ static int scan_block_fast(struct mtd_info *mtd, struct nand_bbt_descr *bd,
        struct mtd_oob_ops ops;
        int j, ret;
 
-       ops.len = mtd->oobsize;
        ops.ooblen = mtd->oobsize;
        ops.oobbuf = buf;
        ops.ooboffs = 0;
@@ -676,10 +673,10 @@ static int write_bbt(struct mtd_info *mtd, uint8_t *buf,
                                       "bad block table\n");
                        }
                        /* Read oob data */
-                       ops.len = (len >> this->page_shift) * mtd->oobsize;
+                       ops.ooblen = (len >> this->page_shift) * mtd->oobsize;
                        ops.oobbuf = &buf[len];
                        res = mtd->read_oob(mtd, to + mtd->writesize, &ops);
-                       if (res < 0 || ops.retlen != ops.len)
+                       if (res < 0 || ops.oobretlen != ops.ooblen)
                                goto outerr;
 
                        /* Calc the byte offset in the buffer */
@@ -759,7 +756,7 @@ static inline int nand_memory_bbt(struct mtd_info *mtd, struct nand_bbt_descr *b
        struct nand_chip *this = mtd->priv;
 
        bd->options &= ~NAND_BBT_SCANEMPTY;
-       return create_bbt(mtd, this->buffers.databuf, bd, -1);
+       return create_bbt(mtd, this->buffers->databuf, bd, -1);
 }
 
 /**
@@ -961,14 +958,12 @@ int nand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd)
        struct nand_bbt_descr *md = this->bbt_md;
 
        len = mtd->size >> (this->bbt_erase_shift + 2);
-       /* Allocate memory (2bit per block) */
-       this->bbt = kmalloc(len, GFP_KERNEL);
+       /* Allocate memory (2bit per block) and clear the memory bad block table */
+       this->bbt = kzalloc(len, GFP_KERNEL);
        if (!this->bbt) {
                printk(KERN_ERR "nand_scan_bbt: Out of memory\n");
                return -ENOMEM;
        }
-       /* Clear the memory bad block table */
-       memset(this->bbt, 0x00, len);
 
        /* If no primary table decriptor is given, scan the device
         * to build a memory based bad block table