diff options
author | Dan Carpenter <dan.carpenter@oracle.com> | 2022-07-18 14:14:09 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2022-07-18 13:11:11 -0600 |
commit | fe3333f6953848f1c24e91a1cf70eed026dc3a86 (patch) | |
tree | 6c4e5b0991e2d5f192a538ea2d3a4b9a194455be /drivers/block | |
parent | d276a22314c2bad9136c5e0b09eb3c8a560e1161 (diff) | |
download | linux-fe3333f6953848f1c24e91a1cf70eed026dc3a86.tar.bz2 |
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: cebbe577cb17 ("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>
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/ublk_drv.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 796d8230fb60..b90481b295a7 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -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; } |