Commit 80f6d6c0 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] md switched to dynamic allocation

parent 7665869a
......@@ -1389,10 +1389,9 @@ static int do_md_run(mddev_t * mddev)
#endif
}
disk = kmalloc(sizeof(struct gendisk), GFP_KERNEL);
disk = alloc_disk();
if (!disk)
return -ENOMEM;
memset(disk, 0, sizeof(struct gendisk));
disk->major = MD_MAJOR;
disk->first_minor = mdidx(mddev);
disk->minor_shift = 0;
......@@ -1408,7 +1407,7 @@ static int do_md_run(mddev_t * mddev)
if (err) {
printk(KERN_ERR "md: pers->run() failed ...\n");
mddev->pers = NULL;
kfree(disk);
put_disk(disk);
return -EINVAL;
}
......@@ -1538,7 +1537,7 @@ static int do_md_stop(mddev_t * mddev, int ro)
if (disk) {
del_gendisk(disk);
kfree(disk);
put_disk(disk);
}
} else
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment