aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/onenand/onenand_bbt.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/onenand/onenand_bbt.c')
-rw-r--r--drivers/mtd/onenand/onenand_bbt.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/mtd/onenand/onenand_bbt.c b/drivers/mtd/onenand/onenand_bbt.c
index 1b00dac3d7d6..e3822c1cdb8d 100644
--- a/drivers/mtd/onenand/onenand_bbt.c
+++ b/drivers/mtd/onenand/onenand_bbt.c
@@ -177,14 +177,12 @@ int onenand_scan_bbt(struct mtd_info *mtd, struct nand_bbt_descr *bd)
177 int len, ret = 0; 177 int len, ret = 0;
178 178
179 len = mtd->size >> (this->erase_shift + 2); 179 len = mtd->size >> (this->erase_shift + 2);
180 /* Allocate memory (2bit per block) */ 180 /* Allocate memory (2bit per block) and clear the memory bad block table */
181 bbm->bbt = kmalloc(len, GFP_KERNEL); 181 bbm->bbt = kzalloc(len, GFP_KERNEL);
182 if (!bbm->bbt) { 182 if (!bbm->bbt) {
183 printk(KERN_ERR "onenand_scan_bbt: Out of memory\n"); 183 printk(KERN_ERR "onenand_scan_bbt: Out of memory\n");
184 return -ENOMEM; 184 return -ENOMEM;
185 } 185 }
186 /* Clear the memory bad block table */
187 memset(bbm->bbt, 0x00, len);
188 186
189 /* Set the bad block position */ 187 /* Set the bad block position */
190 bbm->badblockpos = ONENAND_BADBLOCK_POS; 188 bbm->badblockpos = ONENAND_BADBLOCK_POS;
@@ -230,14 +228,12 @@ int onenand_default_bbt(struct mtd_info *mtd)
230 struct onenand_chip *this = mtd->priv; 228 struct onenand_chip *this = mtd->priv;
231 struct bbm_info *bbm; 229 struct bbm_info *bbm;
232 230
233 this->bbm = kmalloc(sizeof(struct bbm_info), GFP_KERNEL); 231 this->bbm = kzalloc(sizeof(struct bbm_info), GFP_KERNEL);
234 if (!this->bbm) 232 if (!this->bbm)
235 return -ENOMEM; 233 return -ENOMEM;
236 234
237 bbm = this->bbm; 235 bbm = this->bbm;
238 236
239 memset(bbm, 0, sizeof(struct bbm_info));
240
241 /* 1KB page has same configuration as 2KB page */ 237 /* 1KB page has same configuration as 2KB page */
242 if (!bbm->badblock_pattern) 238 if (!bbm->badblock_pattern)
243 bbm->badblock_pattern = &largepage_memorybased; 239 bbm->badblock_pattern = &largepage_memorybased;