diff options
Diffstat (limited to 'drivers/block/rd.c')
-rw-r--r-- | drivers/block/rd.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/drivers/block/rd.c b/drivers/block/rd.c index 701ea77f62e9..80e1585b741e 100644 --- a/drivers/block/rd.c +++ b/drivers/block/rd.c | |||
@@ -411,6 +411,9 @@ static void __exit rd_cleanup(void) | |||
411 | blk_cleanup_queue(rd_queue[i]); | 411 | blk_cleanup_queue(rd_queue[i]); |
412 | } | 412 | } |
413 | unregister_blkdev(RAMDISK_MAJOR, "ramdisk"); | 413 | unregister_blkdev(RAMDISK_MAJOR, "ramdisk"); |
414 | |||
415 | bdi_destroy(&rd_file_backing_dev_info); | ||
416 | bdi_destroy(&rd_backing_dev_info); | ||
414 | } | 417 | } |
415 | 418 | ||
416 | /* | 419 | /* |
@@ -419,7 +422,19 @@ static void __exit rd_cleanup(void) | |||
419 | static int __init rd_init(void) | 422 | static int __init rd_init(void) |
420 | { | 423 | { |
421 | int i; | 424 | int i; |
422 | int err = -ENOMEM; | 425 | int err; |
426 | |||
427 | err = bdi_init(&rd_backing_dev_info); | ||
428 | if (err) | ||
429 | goto out2; | ||
430 | |||
431 | err = bdi_init(&rd_file_backing_dev_info); | ||
432 | if (err) { | ||
433 | bdi_destroy(&rd_backing_dev_info); | ||
434 | goto out2; | ||
435 | } | ||
436 | |||
437 | err = -ENOMEM; | ||
423 | 438 | ||
424 | if (rd_blocksize > PAGE_SIZE || rd_blocksize < 512 || | 439 | if (rd_blocksize > PAGE_SIZE || rd_blocksize < 512 || |
425 | (rd_blocksize & (rd_blocksize-1))) { | 440 | (rd_blocksize & (rd_blocksize-1))) { |
@@ -473,6 +488,9 @@ out: | |||
473 | put_disk(rd_disks[i]); | 488 | put_disk(rd_disks[i]); |
474 | blk_cleanup_queue(rd_queue[i]); | 489 | blk_cleanup_queue(rd_queue[i]); |
475 | } | 490 | } |
491 | bdi_destroy(&rd_backing_dev_info); | ||
492 | bdi_destroy(&rd_file_backing_dev_info); | ||
493 | out2: | ||
476 | return err; | 494 | return err; |
477 | } | 495 | } |
478 | 496 | ||