aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdblock.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/mtdblock.c')
-rw-r--r--drivers/mtd/mtdblock.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c
index a052648f6e31..952da30b1745 100644
--- a/drivers/mtd/mtdblock.c
+++ b/drivers/mtd/mtdblock.c
@@ -278,11 +278,10 @@ static int mtdblock_open(struct mtd_blktrans_dev *mbd)
278 } 278 }
279 279
280 /* OK, it's not open. Create cache info for it */ 280 /* OK, it's not open. Create cache info for it */
281 mtdblk = kmalloc(sizeof(struct mtdblk_dev), GFP_KERNEL); 281 mtdblk = kzalloc(sizeof(struct mtdblk_dev), GFP_KERNEL);
282 if (!mtdblk) 282 if (!mtdblk)
283 return -ENOMEM; 283 return -ENOMEM;
284 284
285 memset(mtdblk, 0, sizeof(*mtdblk));
286 mtdblk->count = 1; 285 mtdblk->count = 1;
287 mtdblk->mtd = mtd; 286 mtdblk->mtd = mtd;
288 287
@@ -339,13 +338,11 @@ static int mtdblock_flush(struct mtd_blktrans_dev *dev)
339 338
340static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) 339static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
341{ 340{
342 struct mtd_blktrans_dev *dev = kmalloc(sizeof(*dev), GFP_KERNEL); 341 struct mtd_blktrans_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
343 342
344 if (!dev) 343 if (!dev)
345 return; 344 return;
346 345
347 memset(dev, 0, sizeof(*dev));
348
349 dev->mtd = mtd; 346 dev->mtd = mtd;
350 dev->devnum = mtd->index; 347 dev->devnum = mtd->index;
351 348