diff --git a/block/genhd.c b/block/genhd.c index 1dd8fd6613b8d20e2292b73d001396efe1a6f718..78b82d26aa9c446d9a1d898a4224f05038fe2c26 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -655,10 +655,12 @@ static void register_disk(struct device *parent, struct gendisk *disk, kobject_uevent(&part_to_dev(part)->kobj, KOBJ_ADD); disk_part_iter_exit(&piter); - err = sysfs_create_link(&ddev->kobj, - &disk->queue->backing_dev_info->dev->kobj, - "bdi"); - WARN_ON(err); + if (disk->queue->backing_dev_info->dev) { + err = sysfs_create_link(&ddev->kobj, + &disk->queue->backing_dev_info->dev->kobj, + "bdi"); + WARN_ON(err); + } } /**