summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
Diffstat (limited to 'block')
-rw-r--r--block/genhd.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/block/genhd.c b/block/genhd.c
index ab455f110be2..f05e58f214d2 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -518,8 +518,13 @@ void device_add_disk(struct device *parent, struct gendisk *disk,
disk->major, disk->first_minor);
WARN_ON(ret);
bdi_set_owner(disk->bdi, ddev);
- bdev_add(disk->part0, ddev->devt);
+ if (disk->bdi->dev) {
+ ret = sysfs_create_link(&ddev->kobj,
+ &disk->bdi->dev->kobj, "bdi");
+ WARN_ON(ret);
+ }
+ bdev_add(disk->part0, ddev->devt);
disk_scan_partitions(disk);
/*
@@ -528,12 +533,6 @@ void device_add_disk(struct device *parent, struct gendisk *disk,
*/
dev_set_uevent_suppress(ddev, 0);
disk_uevent(disk, KOBJ_ADD);
-
- if (disk->bdi->dev) {
- ret = sysfs_create_link(&ddev->kobj,
- &disk->bdi->dev->kobj, "bdi");
- WARN_ON(ret);
- }
}
blk_register_queue(disk);