aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/mtdblock_ro.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/mtdblock_ro.c')
-rw-r--r--drivers/mtd/mtdblock_ro.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/mtd/mtdblock_ro.c b/drivers/mtd/mtdblock_ro.c
index 29563ed258a4..f79dbb49b1a2 100644
--- a/drivers/mtd/mtdblock_ro.c
+++ b/drivers/mtd/mtdblock_ro.c
@@ -33,16 +33,14 @@ static int mtdblock_writesect(struct mtd_blktrans_dev *dev,
33 33
34static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) 34static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
35{ 35{
36 struct mtd_blktrans_dev *dev = kmalloc(sizeof(*dev), GFP_KERNEL); 36 struct mtd_blktrans_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
37 37
38 if (!dev) 38 if (!dev)
39 return; 39 return;
40 40
41 memset(dev, 0, sizeof(*dev));
42
43 dev->mtd = mtd; 41 dev->mtd = mtd;
44 dev->devnum = mtd->index; 42 dev->devnum = mtd->index;
45 dev->blksize = 512; 43
46 dev->size = mtd->size >> 9; 44 dev->size = mtd->size >> 9;
47 dev->tr = tr; 45 dev->tr = tr;
48 dev->readonly = 1; 46 dev->readonly = 1;
@@ -60,6 +58,7 @@ static struct mtd_blktrans_ops mtdblock_tr = {
60 .name = "mtdblock", 58 .name = "mtdblock",
61 .major = 31, 59 .major = 31,
62 .part_bits = 0, 60 .part_bits = 0,
61 .blksize = 512,
63 .readsect = mtdblock_readsect, 62 .readsect = mtdblock_readsect,
64 .writesect = mtdblock_writesect, 63 .writesect = mtdblock_writesect,
65 .add_mtd = mtdblock_add_mtd, 64 .add_mtd = mtdblock_add_mtd,