Commit 35b489d3 authored by Ming Lei's avatar Ming Lei Committed by Jens Axboe

block: fix checking return value of blk_mq_init_queue

Check IS_ERR_OR_NULL(return value) instead of just return value.
Signed-off-by: default avatarMing Lei <ming.lei@canonical.com>

Reduced to IS_ERR() by me, we never return NULL.
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent aed3ea94
...@@ -530,7 +530,7 @@ static int null_add_dev(void) ...@@ -530,7 +530,7 @@ static int null_add_dev(void)
goto out_cleanup_queues; goto out_cleanup_queues;
nullb->q = blk_mq_init_queue(&nullb->tag_set); nullb->q = blk_mq_init_queue(&nullb->tag_set);
if (!nullb->q) { if (IS_ERR(nullb->q)) {
rv = -ENOMEM; rv = -ENOMEM;
goto out_cleanup_tags; goto out_cleanup_tags;
} }
......
...@@ -1376,7 +1376,7 @@ static int nvme_alloc_admin_tags(struct nvme_dev *dev) ...@@ -1376,7 +1376,7 @@ static int nvme_alloc_admin_tags(struct nvme_dev *dev)
return -ENOMEM; return -ENOMEM;
dev->admin_q = blk_mq_init_queue(&dev->admin_tagset); dev->admin_q = blk_mq_init_queue(&dev->admin_tagset);
if (!dev->admin_q) { if (IS_ERR(dev->admin_q)) {
blk_mq_free_tag_set(&dev->admin_tagset); blk_mq_free_tag_set(&dev->admin_tagset);
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -638,7 +638,7 @@ static int virtblk_probe(struct virtio_device *vdev) ...@@ -638,7 +638,7 @@ static int virtblk_probe(struct virtio_device *vdev)
goto out_put_disk; goto out_put_disk;
q = vblk->disk->queue = blk_mq_init_queue(&vblk->tag_set); q = vblk->disk->queue = blk_mq_init_queue(&vblk->tag_set);
if (!q) { if (IS_ERR(q)) {
err = -ENOMEM; err = -ENOMEM;
goto out_free_tags; goto out_free_tags;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment