aboutsummaryrefslogtreecommitdiff
path: root/drivers/block/ublk_drv.c
diff options
context:
space:
mode:
authorYang Yingliang2022-07-18 12:24:08 +0800
committerJens Axboe2022-07-18 13:10:22 -0600
commitf50e5d670c622349277a46996a70386cc3661b10 (patch)
tree59d94d0eb99b5d3ddf87feb1fdc7d38eb69d8c3e /drivers/block/ublk_drv.c
parentf2450f8a2c1ec3e88d6674f747b913aa5f21fa59 (diff)
ublk_drv: fix missing error return code in ublk_add_dev()
If blk_mq_init_queue() fails, it should return error code in ublk_add_dev() Fixes: cebbe577cb17 ("ublk_drv: fix request queue leak") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Reviewed-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20220718042408.3132835-1-yangyingliang@huawei.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/block/ublk_drv.c')
-rw-r--r--drivers/block/ublk_drv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 2c1b01d7f27d..663626167c0d 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -1169,8 +1169,10 @@ static int ublk_add_dev(struct ublk_device *ub)
goto out_deinit_queues;
ub->ub_queue = blk_mq_init_queue(&ub->tag_set);
- if (IS_ERR(ub->ub_queue))
+ if (IS_ERR(ub->ub_queue)) {
+ err = PTR_ERR(ub->ub_queue);
goto out_cleanup_tags;
+ }
ub->ub_queue->queuedata = ub;
disk = ub->ub_disk = blk_mq_alloc_disk_for_queue(ub->ub_queue,