summaryrefslogtreecommitdiff
path: root/block
diff options
context:
space:
mode:
authorweiping zhang <zhangweiping@didichuxing.com>2017-10-31 18:38:59 +0800
committerJens Axboe <axboe@kernel.dk>2017-11-19 11:02:13 -0700
commit3a92168bc8a113098b44a95d499557a88bb387da (patch)
tree6115d091d809f3844ae1894e83c597e8d26d5ac8 /block
parenta0747a859ef6d3cc5b6cd50eb694499b78dd0025 (diff)
block: add WARN_ON if bdi register fail
device_add_disk need do more safety error handle, so this patch just add WARN_ON. Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: weiping zhang <zhangweiping@didichuxing.com> Adapted for current series by me. Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block')
-rw-r--r--block/genhd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/block/genhd.c b/block/genhd.c
index c2223f12a805..c143a2274238 100644
--- a/block/genhd.c
+++ b/block/genhd.c
@@ -671,10 +671,13 @@ void device_add_disk(struct device *parent, struct gendisk *disk)
disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO;
disk->flags |= GENHD_FL_NO_PART_SCAN;
} else {
+ int ret;
+
/* Register BDI before referencing it from bdev */
disk_to_dev(disk)->devt = devt;
- bdi_register_owner(disk->queue->backing_dev_info,
- disk_to_dev(disk));
+ ret = bdi_register_owner(disk->queue->backing_dev_info,
+ disk_to_dev(disk));
+ WARN_ON(ret);
blk_register_region(disk_devt(disk), disk->minors, NULL,
exact_match, exact_lock, disk);
}