Message ID | YtVAgedTsQVK1oTM@kili (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [1/3] ublk_drv: fix an IS_ERR() vs NULL check | expand |
On Mon, Jul 18, 2022 at 02:14:09PM +0300, Dan Carpenter wrote: > 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> > --- > drivers/block/ublk_drv.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c > index 52fd0af8a4f2..97725d13e4bd 100644 > --- a/drivers/block/ublk_drv.c > +++ b/drivers/block/ublk_drv.c > @@ -1175,8 +1175,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; > } Reviewed-by: Ming Lei <ming.lei@redhat.com> Thanks, Ming
On Mon, 18 Jul 2022 14:14:09 +0300, Dan Carpenter wrote: > The blk_mq_alloc_disk_for_queue() doesn't return error pointers, it > returns NULL on error. > > Applied, thanks! [1/3] ublk_drv: fix an IS_ERR() vs NULL check commit: fe3333f6953848f1c24e91a1cf70eed026dc3a86 Best regards,
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 52fd0af8a4f2..97725d13e4bd 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -1175,8 +1175,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; }
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> --- drivers/block/ublk_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)