aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2006-01-06 03:20:32 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-01-06 11:34:05 -0500
commit9ffae0cf3ea02f75d163922accfd3e592d87adde (patch)
tree4974727e9f36e1b618b68d2789644ee3a0d7a371 /drivers/md/md.c
parent2d1f3b5d1b2cd11a162eb29645df749ec0036413 (diff)
[PATCH] md: convert md to use kzalloc throughout
Replace multiple kmalloc/memset pairs with kzalloc calls. Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index c3ac67cffe62..8c378b62a676 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -228,12 +228,10 @@ static mddev_t * mddev_find(dev_t unit)
228 } 228 }
229 spin_unlock(&all_mddevs_lock); 229 spin_unlock(&all_mddevs_lock);
230 230
231 new = (mddev_t *) kmalloc(sizeof(*new), GFP_KERNEL); 231 new = kzalloc(sizeof(*new), GFP_KERNEL);
232 if (!new) 232 if (!new)
233 return NULL; 233 return NULL;
234 234
235 memset(new, 0, sizeof(*new));
236
237 new->unit = unit; 235 new->unit = unit;
238 if (MAJOR(unit) == MD_MAJOR) 236 if (MAJOR(unit) == MD_MAJOR)
239 new->md_minor = MINOR(unit); 237 new->md_minor = MINOR(unit);
@@ -1620,12 +1618,11 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int super_format, int super_mi
1620 mdk_rdev_t *rdev; 1618 mdk_rdev_t *rdev;
1621 sector_t size; 1619 sector_t size;
1622 1620
1623 rdev = (mdk_rdev_t *) kmalloc(sizeof(*rdev), GFP_KERNEL); 1621 rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
1624 if (!rdev) { 1622 if (!rdev) {
1625 printk(KERN_ERR "md: could not alloc mem for new device!\n"); 1623 printk(KERN_ERR "md: could not alloc mem for new device!\n");
1626 return ERR_PTR(-ENOMEM); 1624 return ERR_PTR(-ENOMEM);
1627 } 1625 }
1628 memset(rdev, 0, sizeof(*rdev));
1629 1626
1630 if ((err = alloc_disk_sb(rdev))) 1627 if ((err = alloc_disk_sb(rdev)))
1631 goto abort_free; 1628 goto abort_free;
@@ -3505,11 +3502,10 @@ mdk_thread_t *md_register_thread(void (*run) (mddev_t *), mddev_t *mddev,
3505{ 3502{
3506 mdk_thread_t *thread; 3503 mdk_thread_t *thread;
3507 3504
3508 thread = kmalloc(sizeof(mdk_thread_t), GFP_KERNEL); 3505 thread = kzalloc(sizeof(mdk_thread_t), GFP_KERNEL);
3509 if (!thread) 3506 if (!thread)
3510 return NULL; 3507 return NULL;
3511 3508
3512 memset(thread, 0, sizeof(mdk_thread_t));
3513 init_waitqueue_head(&thread->wqueue); 3509 init_waitqueue_head(&thread->wqueue);
3514 3510
3515 thread->run = run; 3511 thread->run = run;