diff options
Diffstat (limited to 'drivers/mtd/nftlcore.c')
-rw-r--r-- | drivers/mtd/nftlcore.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/mtd/nftlcore.c b/drivers/mtd/nftlcore.c index b5a5f8da4722..4b1ba4fcfcd3 100644 --- a/drivers/mtd/nftlcore.c +++ b/drivers/mtd/nftlcore.c | |||
@@ -57,17 +57,16 @@ static void nftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd) | |||
57 | 57 | ||
58 | DEBUG(MTD_DEBUG_LEVEL1, "NFTL: add_mtd for %s\n", mtd->name); | 58 | DEBUG(MTD_DEBUG_LEVEL1, "NFTL: add_mtd for %s\n", mtd->name); |
59 | 59 | ||
60 | nftl = kmalloc(sizeof(struct NFTLrecord), GFP_KERNEL); | 60 | nftl = kzalloc(sizeof(struct NFTLrecord), GFP_KERNEL); |
61 | 61 | ||
62 | if (!nftl) { | 62 | if (!nftl) { |
63 | printk(KERN_WARNING "NFTL: out of memory for data structures\n"); | 63 | printk(KERN_WARNING "NFTL: out of memory for data structures\n"); |
64 | return; | 64 | return; |
65 | } | 65 | } |
66 | memset(nftl, 0, sizeof(*nftl)); | ||
67 | 66 | ||
68 | nftl->mbd.mtd = mtd; | 67 | nftl->mbd.mtd = mtd; |
69 | nftl->mbd.devnum = -1; | 68 | nftl->mbd.devnum = -1; |
70 | nftl->mbd.blksize = 512; | 69 | |
71 | nftl->mbd.tr = tr; | 70 | nftl->mbd.tr = tr; |
72 | 71 | ||
73 | if (NFTL_mount(nftl) < 0) { | 72 | if (NFTL_mount(nftl) < 0) { |
@@ -147,10 +146,9 @@ int nftl_read_oob(struct mtd_info *mtd, loff_t offs, size_t len, | |||
147 | ops.ooblen = len; | 146 | ops.ooblen = len; |
148 | ops.oobbuf = buf; | 147 | ops.oobbuf = buf; |
149 | ops.datbuf = NULL; | 148 | ops.datbuf = NULL; |
150 | ops.len = len; | ||
151 | 149 | ||
152 | res = mtd->read_oob(mtd, offs & ~(mtd->writesize - 1), &ops); | 150 | res = mtd->read_oob(mtd, offs & ~(mtd->writesize - 1), &ops); |
153 | *retlen = ops.retlen; | 151 | *retlen = ops.oobretlen; |
154 | return res; | 152 | return res; |
155 | } | 153 | } |
156 | 154 | ||
@@ -168,10 +166,9 @@ int nftl_write_oob(struct mtd_info *mtd, loff_t offs, size_t len, | |||
168 | ops.ooblen = len; | 166 | ops.ooblen = len; |
169 | ops.oobbuf = buf; | 167 | ops.oobbuf = buf; |
170 | ops.datbuf = NULL; | 168 | ops.datbuf = NULL; |
171 | ops.len = len; | ||
172 | 169 | ||
173 | res = mtd->write_oob(mtd, offs & ~(mtd->writesize - 1), &ops); | 170 | res = mtd->write_oob(mtd, offs & ~(mtd->writesize - 1), &ops); |
174 | *retlen = ops.retlen; | 171 | *retlen = ops.oobretlen; |
175 | return res; | 172 | return res; |
176 | } | 173 | } |
177 | 174 | ||
@@ -797,6 +794,7 @@ static struct mtd_blktrans_ops nftl_tr = { | |||
797 | .name = "nftl", | 794 | .name = "nftl", |
798 | .major = NFTL_MAJOR, | 795 | .major = NFTL_MAJOR, |
799 | .part_bits = NFTL_PARTN_BITS, | 796 | .part_bits = NFTL_PARTN_BITS, |
797 | .blksize = 512, | ||
800 | .getgeo = nftl_getgeo, | 798 | .getgeo = nftl_getgeo, |
801 | .readsect = nftl_readblock, | 799 | .readsect = nftl_readblock, |
802 | #ifdef CONFIG_NFTL_RW | 800 | #ifdef CONFIG_NFTL_RW |