aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/devices/slram.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/devices/slram.c')
-rw-r--r--drivers/mtd/devices/slram.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/mtd/devices/slram.c b/drivers/mtd/devices/slram.c
index 542a0c009006..5f49248a4856 100644
--- a/drivers/mtd/devices/slram.c
+++ b/drivers/mtd/devices/slram.c
@@ -168,19 +168,16 @@ static int register_device(char *name, unsigned long start, unsigned long length
168 E("slram: Cannot allocate new MTD device.\n"); 168 E("slram: Cannot allocate new MTD device.\n");
169 return(-ENOMEM); 169 return(-ENOMEM);
170 } 170 }
171 (*curmtd)->mtdinfo = kmalloc(sizeof(struct mtd_info), GFP_KERNEL); 171 (*curmtd)->mtdinfo = kzalloc(sizeof(struct mtd_info), GFP_KERNEL);
172 (*curmtd)->next = NULL; 172 (*curmtd)->next = NULL;
173 173
174 if ((*curmtd)->mtdinfo) { 174 if ((*curmtd)->mtdinfo) {
175 memset((char *)(*curmtd)->mtdinfo, 0, sizeof(struct mtd_info));
176 (*curmtd)->mtdinfo->priv = 175 (*curmtd)->mtdinfo->priv =
177 kmalloc(sizeof(slram_priv_t), GFP_KERNEL); 176 kzalloc(sizeof(slram_priv_t), GFP_KERNEL);
178 177
179 if (!(*curmtd)->mtdinfo->priv) { 178 if (!(*curmtd)->mtdinfo->priv) {
180 kfree((*curmtd)->mtdinfo); 179 kfree((*curmtd)->mtdinfo);
181 (*curmtd)->mtdinfo = NULL; 180 (*curmtd)->mtdinfo = NULL;
182 } else {
183 memset((*curmtd)->mtdinfo->priv,0,sizeof(slram_priv_t));
184 } 181 }
185 } 182 }
186 183