aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/nvme.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/block/nvme.c')
-rw-r--r--drivers/block/nvme.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/block/nvme.c b/drivers/block/nvme.c
index 2948043483fe..bfdca3a3a41a 100644
--- a/drivers/block/nvme.c
+++ b/drivers/block/nvme.c
@@ -451,7 +451,8 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns,
451 dma_dir = DMA_FROM_DEVICE; 451 dma_dir = DMA_FROM_DEVICE;
452 } 452 }
453 453
454 nvme_map_bio(nvmeq->q_dmadev, nbio, bio, dma_dir, psegs); 454 if (nvme_map_bio(nvmeq->q_dmadev, nbio, bio, dma_dir, psegs) == 0)
455 goto mapping_failed;
455 456
456 cmnd->rw.flags = 1; 457 cmnd->rw.flags = 1;
457 cmnd->rw.command_id = cmdid; 458 cmnd->rw.command_id = cmdid;
@@ -471,6 +472,11 @@ static int nvme_submit_bio_queue(struct nvme_queue *nvmeq, struct nvme_ns *ns,
471 472
472 return 0; 473 return 0;
473 474
475 mapping_failed:
476 free_nbio(nvmeq, nbio);
477 bio_endio(bio, -ENOMEM);
478 return 0;
479
474 free_nbio: 480 free_nbio:
475 free_nbio(nvmeq, nbio); 481 free_nbio(nvmeq, nbio);
476 congestion: 482 congestion: