diff options
Diffstat (limited to 'block/genhd.c')
-rw-r--r-- | block/genhd.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/block/genhd.c b/block/genhd.c index 6d1003f0d..398dab06d 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -1112,8 +1112,7 @@ static void disk_release(struct device *dev) disk_release_events(disk); kfree(disk->random); disk_replace_part_tbl(disk, NULL); - free_part_stats(&disk->part0); - free_part_info(&disk->part0); + hd_free_part(&disk->part0); if (disk->queue) blk_put_queue(disk->queue); kfree(disk); @@ -1287,7 +1286,11 @@ struct gendisk *alloc_disk_node(int minors, int node_id) * converted to make use of bd_mutex and sequence counters. */ seqcount_init(&disk->part0.nr_sects_seq); - hd_ref_init(&disk->part0); + if (hd_ref_init(&disk->part0)) { + hd_free_part(&disk->part0); + kfree(disk); + return NULL; + } disk->minors = minors; rand_initialize_disk(disk); |