lightnvm: propagate right error code to target
authorJavier González <jg@lightnvm.io>
Mon, 26 Jun 2017 09:57:11 +0000 (11:57 +0200)
committerJens Axboe <axboe@kernel.dk>
Mon, 26 Jun 2017 22:24:53 +0000 (16:24 -0600)
If nvme_alloc_request fails, propagate the right error, instead of
assuming ENOMEM.

Signed-off-by: Javier González <javier@cnexlabs.com>
Signed-off-by: Matias Bjørling <matias@cnexlabs.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/nvme/host/lightnvm.c

index e1ef8e9b41cb04606a8f85a9df3b8f269d84c886..be8541335e31edb0d621aa13e0dd3e74670fa168 100644 (file)
@@ -509,7 +509,7 @@ static int nvme_nvm_submit_io(struct nvm_dev *dev, struct nvm_rq *rqd)
        rq = nvme_alloc_request(q, (struct nvme_command *)cmd, 0, NVME_QID_ANY);
        if (IS_ERR(rq)) {
                kfree(cmd);
-               return -ENOMEM;
+               return PTR_ERR(rq);
        }
        rq->cmd_flags &= ~REQ_FAILFAST_DRIVER;