Commit 9f173b33 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jens Axboe

NVMe: blk_mq_alloc_request() returns error pointers

We recently converted this to blk_mq but the error checks have to be
updated to check for IS_ERR() instead of NULL.

Fixes: a4aea562 ('NVMe: Convert to blk-mq')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent a4aea562
...@@ -826,8 +826,8 @@ static int nvme_submit_async_admin_req(struct nvme_dev *dev) ...@@ -826,8 +826,8 @@ static int nvme_submit_async_admin_req(struct nvme_dev *dev)
struct request *req; struct request *req;
req = blk_mq_alloc_request(dev->admin_q, WRITE, GFP_KERNEL, false); req = blk_mq_alloc_request(dev->admin_q, WRITE, GFP_KERNEL, false);
if (!req) if (IS_ERR(req))
return -ENOMEM; return PTR_ERR(req);
cmd_info = blk_mq_rq_to_pdu(req); cmd_info = blk_mq_rq_to_pdu(req);
nvme_set_info(cmd_info, req, async_req_completion); nvme_set_info(cmd_info, req, async_req_completion);
...@@ -848,8 +848,8 @@ static int nvme_submit_admin_async_cmd(struct nvme_dev *dev, ...@@ -848,8 +848,8 @@ static int nvme_submit_admin_async_cmd(struct nvme_dev *dev,
struct nvme_cmd_info *cmd_rq; struct nvme_cmd_info *cmd_rq;
req = blk_mq_alloc_request(dev->admin_q, WRITE, GFP_KERNEL, false); req = blk_mq_alloc_request(dev->admin_q, WRITE, GFP_KERNEL, false);
if (!req) if (IS_ERR(req))
return -ENOMEM; return PTR_ERR(req);
req->timeout = timeout; req->timeout = timeout;
cmd_rq = blk_mq_rq_to_pdu(req); cmd_rq = blk_mq_rq_to_pdu(req);
...@@ -1026,7 +1026,7 @@ static void nvme_abort_req(struct request *req) ...@@ -1026,7 +1026,7 @@ static void nvme_abort_req(struct request *req)
abort_req = blk_mq_alloc_request(dev->admin_q, WRITE, GFP_ATOMIC, abort_req = blk_mq_alloc_request(dev->admin_q, WRITE, GFP_ATOMIC,
false); false);
if (!abort_req) if (IS_ERR(abort_req))
return; return;
abort_cmd = blk_mq_rq_to_pdu(abort_req); abort_cmd = blk_mq_rq_to_pdu(abort_req);
...@@ -1884,7 +1884,7 @@ static struct nvme_ns *nvme_alloc_ns(struct nvme_dev *dev, unsigned nsid, ...@@ -1884,7 +1884,7 @@ static struct nvme_ns *nvme_alloc_ns(struct nvme_dev *dev, unsigned nsid,
if (!ns) if (!ns)
return NULL; return NULL;
ns->queue = blk_mq_init_queue(&dev->tagset); ns->queue = blk_mq_init_queue(&dev->tagset);
if (!ns->queue) if (IS_ERR(ns->queue))
goto out_free_ns; goto out_free_ns;
queue_flag_set_unlocked(QUEUE_FLAG_NOMERGES, ns->queue); queue_flag_set_unlocked(QUEUE_FLAG_NOMERGES, ns->queue);
queue_flag_set_unlocked(QUEUE_FLAG_NONROT, ns->queue); queue_flag_set_unlocked(QUEUE_FLAG_NONROT, ns->queue);
......
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