提交 97fe3832 编写于 作者: J Jens Axboe

NVMe: fix error return checking from blk_mq_alloc_request()

We return an error pointer or the request, not NULL. Half
the call paths got it right, the others didn't. Fix those up.
Signed-off-by: NJens Axboe <axboe@fb.com>
上级 c87fd540
...@@ -875,8 +875,8 @@ static int __nvme_submit_admin_cmd(struct nvme_dev *dev, struct nvme_command *cm ...@@ -875,8 +875,8 @@ static int __nvme_submit_admin_cmd(struct nvme_dev *dev, struct nvme_command *cm
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);
res = nvme_submit_sync_cmd(req, cmd, result, timeout); res = nvme_submit_sync_cmd(req, cmd, result, timeout);
blk_mq_free_request(req); blk_mq_free_request(req);
return res; return res;
...@@ -896,8 +896,8 @@ int nvme_submit_io_cmd(struct nvme_dev *dev, struct nvme_ns *ns, ...@@ -896,8 +896,8 @@ int nvme_submit_io_cmd(struct nvme_dev *dev, struct nvme_ns *ns,
req = blk_mq_alloc_request(ns->queue, WRITE, (GFP_KERNEL|__GFP_WAIT), req = blk_mq_alloc_request(ns->queue, WRITE, (GFP_KERNEL|__GFP_WAIT),
false); false);
if (!req) if (IS_ERR(req))
return -ENOMEM; return PTR_ERR(req);
res = nvme_submit_sync_cmd(req, cmd, result, NVME_IO_TIMEOUT); res = nvme_submit_sync_cmd(req, cmd, result, NVME_IO_TIMEOUT);
blk_mq_free_request(req); blk_mq_free_request(req);
return res; return res;
...@@ -1691,8 +1691,8 @@ static int nvme_user_cmd(struct nvme_dev *dev, struct nvme_ns *ns, ...@@ -1691,8 +1691,8 @@ static int nvme_user_cmd(struct nvme_dev *dev, struct nvme_ns *ns,
req = blk_mq_alloc_request(ns->queue, WRITE, req = blk_mq_alloc_request(ns->queue, WRITE,
(GFP_KERNEL|__GFP_WAIT), false); (GFP_KERNEL|__GFP_WAIT), false);
if (!req) if (IS_ERR(req))
status = -ENOMEM; status = PTR_ERR(req);
else { else {
status = nvme_submit_sync_cmd(req, &c, &cmd.result, status = nvme_submit_sync_cmd(req, &c, &cmd.result,
timeout); timeout);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册