diff options
-rw-r--r-- | drivers/block/nvme-core.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c index b82155888845..872d8e42d008 100644 --- a/drivers/block/nvme-core.c +++ b/drivers/block/nvme-core.c | |||
@@ -1488,7 +1488,11 @@ struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write, | |||
1488 | goto put_pages; | 1488 | goto put_pages; |
1489 | } | 1489 | } |
1490 | 1490 | ||
1491 | err = -ENOMEM; | ||
1491 | iod = nvme_alloc_iod(count, length, GFP_KERNEL); | 1492 | iod = nvme_alloc_iod(count, length, GFP_KERNEL); |
1493 | if (!iod) | ||
1494 | goto put_pages; | ||
1495 | |||
1492 | sg = iod->sg; | 1496 | sg = iod->sg; |
1493 | sg_init_table(sg, count); | 1497 | sg_init_table(sg, count); |
1494 | for (i = 0; i < count; i++) { | 1498 | for (i = 0; i < count; i++) { |
@@ -1501,7 +1505,6 @@ struct nvme_iod *nvme_map_user_pages(struct nvme_dev *dev, int write, | |||
1501 | sg_mark_end(&sg[i - 1]); | 1505 | sg_mark_end(&sg[i - 1]); |
1502 | iod->nents = count; | 1506 | iod->nents = count; |
1503 | 1507 | ||
1504 | err = -ENOMEM; | ||
1505 | nents = dma_map_sg(&dev->pci_dev->dev, sg, count, | 1508 | nents = dma_map_sg(&dev->pci_dev->dev, sg, count, |
1506 | write ? DMA_TO_DEVICE : DMA_FROM_DEVICE); | 1509 | write ? DMA_TO_DEVICE : DMA_FROM_DEVICE); |
1507 | if (!nents) | 1510 | if (!nents) |