diff options
author | Burman Yan <yan_952@hotmail.com> | 2006-11-15 14:10:29 -0500 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2006-11-28 18:47:21 -0500 |
commit | 95b93a0cd46682c6d9e8eea803fda510cb6b863a (patch) | |
tree | 7e430d3fc04ed20791187d144730dd3052292c67 /drivers/mtd/devices/slram.c | |
parent | 998a43e72d20afa7566dad66fd866fe939a89c09 (diff) |
[MTD] replace kmalloc+memset with kzalloc
Signed-off-by: Yan Burman <yan_952@hotmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd/devices/slram.c')
-rw-r--r-- | drivers/mtd/devices/slram.c | 7 |
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 | ||