]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ublk_drv: fix an IS_ERR() vs NULL check
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 18 Jul 2022 11:14:09 +0000 (14:14 +0300)
committerJens Axboe <axboe@kernel.dk>
Mon, 18 Jul 2022 19:11:11 +0000 (13:11 -0600)
The blk_mq_alloc_disk_for_queue() doesn't return error pointers, it
returns NULL on error.

Fixes: e40cb4715158 ("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>
drivers/block/ublk_drv.c

index 796d8230fb605aed71a83332ad2cfab8c1d7dfc4..b90481b295a7496d1feff401bb4c289caa24fe8e 100644 (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;
        }