summaryrefslogtreecommitdiff
path: root/drivers/block
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2014-12-10 13:02:44 -0700
committerJens Axboe <axboe@fb.com>2014-12-10 13:02:44 -0700
commit97fe383222cb8a01fb67a8823498ad2edcc20b35 (patch)
tree3ae928bfdb153db22ab0cf3102ad3002c7e1fed9 /drivers/block
parentc87fd5407e1aa1cfc6b393b03bf67010cf643dbe (diff)
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: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/nvme-core.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index cf9b8a8a24d3..2cc2cee7a367 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -875,8 +875,8 @@ static int __nvme_submit_admin_cmd(struct nvme_dev *dev, struct nvme_command *cm
struct request *req;
req = blk_mq_alloc_request(dev->admin_q, WRITE, GFP_KERNEL, false);
- if (!req)
- return -ENOMEM;
+ if (IS_ERR(req))
+ return PTR_ERR(req);
res = nvme_submit_sync_cmd(req, cmd, result, timeout);
blk_mq_free_request(req);
return res;
@@ -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),
false);
- if (!req)
- return -ENOMEM;
+ if (IS_ERR(req))
+ return PTR_ERR(req);
res = nvme_submit_sync_cmd(req, cmd, result, NVME_IO_TIMEOUT);
blk_mq_free_request(req);
return res;
@@ -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,
(GFP_KERNEL|__GFP_WAIT), false);
- if (!req)
- status = -ENOMEM;
+ if (IS_ERR(req))
+ status = PTR_ERR(req);
else {
status = nvme_submit_sync_cmd(req, &c, &cmd.result,
timeout);