summaryrefslogtreecommitdiff
path: root/drivers/mtd/onenand/onenand_bbt.c
diff options
context:
space:
mode:
authorBurman Yan <yan_952@hotmail.com>2006-11-15 21:10:29 +0200
committerDavid Woodhouse <dwmw2@infradead.org>2006-11-28 23:47:21 +0000
commit95b93a0cd46682c6d9e8eea803fda510cb6b863a (patch)
tree7e430d3fc04ed20791187d144730dd3052292c67 /drivers/mtd/onenand/onenand_bbt.c
parent998a43e72d20afa7566dad66fd866fe939a89c09 (diff)
[MTD] replace kmalloc+memset with kzalloc
Signed-off-by: Yan Burman <yan_952@hotmail.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
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 1b00dac3d7d..e3822c1cdb8 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)
int len, ret = 0;
len = mtd->size >> (this->erase_shift + 2);
- /* Allocate memory (2bit per block) */
- bbm->bbt = kmalloc(len, GFP_KERNEL);
+ /* Allocate memory (2bit per block) and clear the memory bad block table */
+ bbm->bbt = kzalloc(len, GFP_KERNEL);
if (!bbm->bbt) {
printk(KERN_ERR "onenand_scan_bbt: Out of memory\n");
return -ENOMEM;
}
- /* Clear the memory bad block table */
- memset(bbm->bbt, 0x00, len);
/* Set the bad block position */
bbm->badblockpos = ONENAND_BADBLOCK_POS;
@@ -230,14 +228,12 @@ int onenand_default_bbt(struct mtd_info *mtd)
struct onenand_chip *this = mtd->priv;
struct bbm_info *bbm;
- this->bbm = kmalloc(sizeof(struct bbm_info), GFP_KERNEL);
+ this->bbm = kzalloc(sizeof(struct bbm_info), GFP_KERNEL);
if (!this->bbm)
return -ENOMEM;
bbm = this->bbm;
- memset(bbm, 0, sizeof(struct bbm_info));
-
/* 1KB page has same configuration as 2KB page */
if (!bbm->badblock_pattern)
bbm->badblock_pattern = &largepage_memorybased;