ublk_drv: fix an IS_ERR() vs NULL check

The blk_mq_alloc_disk_for_queue() doesn't return error pointers, it
returns NULL on error.

Fixes: cebbe577cb ("ublk_drv: fix request queue leak")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/YtVAgedTsQVK1oTM@kili
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
Dan Carpenter 2022-07-18 14:14:09 +03:00 committed by Jens Axboe
parent d276a22314
commit fe3333f695

View File

@ -1174,8 +1174,8 @@ static int ublk_add_dev(struct ublk_device *ub)
disk = ub->ub_disk = blk_mq_alloc_disk_for_queue(ub->ub_queue,
&ublk_bio_compl_lkclass);
if (IS_ERR(disk)) {
err = PTR_ERR(disk);
if (!disk) {
err = -ENOMEM;
goto out_free_request_queue;
}