diff options
Diffstat (limited to 'drivers/mtd/nand/nandsim.c')
-rw-r--r-- | drivers/mtd/nand/nandsim.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index abebcab47631..3d39451ae8f5 100644 --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c | |||
@@ -1511,14 +1511,12 @@ static int __init ns_init_module(void) | |||
1511 | } | 1511 | } |
1512 | 1512 | ||
1513 | /* Allocate and initialize mtd_info, nand_chip and nandsim structures */ | 1513 | /* Allocate and initialize mtd_info, nand_chip and nandsim structures */ |
1514 | nsmtd = kmalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip) | 1514 | nsmtd = kzalloc(sizeof(struct mtd_info) + sizeof(struct nand_chip) |
1515 | + sizeof(struct nandsim), GFP_KERNEL); | 1515 | + sizeof(struct nandsim), GFP_KERNEL); |
1516 | if (!nsmtd) { | 1516 | if (!nsmtd) { |
1517 | NS_ERR("unable to allocate core structures.\n"); | 1517 | NS_ERR("unable to allocate core structures.\n"); |
1518 | return -ENOMEM; | 1518 | return -ENOMEM; |
1519 | } | 1519 | } |
1520 | memset(nsmtd, 0, sizeof(struct mtd_info) + sizeof(struct nand_chip) + | ||
1521 | sizeof(struct nandsim)); | ||
1522 | chip = (struct nand_chip *)(nsmtd + 1); | 1520 | chip = (struct nand_chip *)(nsmtd + 1); |
1523 | nsmtd->priv = (void *)chip; | 1521 | nsmtd->priv = (void *)chip; |
1524 | nand = (struct nandsim *)(chip + 1); | 1522 | nand = (struct nandsim *)(chip + 1); |