Commit cc667f6d authored by Liviu Dudau's avatar Liviu Dudau Committed by Christoph Hellwig

nvme-pci: use the same attributes when freeing host_mem_desc_bufs.

When using HMB the PCIe host driver allocates host_mem_desc_bufs using
dma_alloc_attrs() but frees them using dma_free_coherent(). Use the
correct dma_free_attrs() function to free the buffers.
Signed-off-by: default avatarLiviu Dudau <liviu@dudau.co.uk>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent c61e678f
...@@ -1885,8 +1885,9 @@ static void nvme_free_host_mem(struct nvme_dev *dev) ...@@ -1885,8 +1885,9 @@ static void nvme_free_host_mem(struct nvme_dev *dev)
struct nvme_host_mem_buf_desc *desc = &dev->host_mem_descs[i]; struct nvme_host_mem_buf_desc *desc = &dev->host_mem_descs[i];
size_t size = le32_to_cpu(desc->size) * dev->ctrl.page_size; size_t size = le32_to_cpu(desc->size) * dev->ctrl.page_size;
dma_free_coherent(dev->dev, size, dev->host_mem_desc_bufs[i], dma_free_attrs(dev->dev, size, dev->host_mem_desc_bufs[i],
le64_to_cpu(desc->addr)); le64_to_cpu(desc->addr),
DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN);
} }
kfree(dev->host_mem_desc_bufs); kfree(dev->host_mem_desc_bufs);
...@@ -1952,8 +1953,9 @@ static int __nvme_alloc_host_mem(struct nvme_dev *dev, u64 preferred, ...@@ -1952,8 +1953,9 @@ static int __nvme_alloc_host_mem(struct nvme_dev *dev, u64 preferred,
while (--i >= 0) { while (--i >= 0) {
size_t size = le32_to_cpu(descs[i].size) * dev->ctrl.page_size; size_t size = le32_to_cpu(descs[i].size) * dev->ctrl.page_size;
dma_free_coherent(dev->dev, size, bufs[i], dma_free_attrs(dev->dev, size, bufs[i],
le64_to_cpu(descs[i].addr)); le64_to_cpu(descs[i].addr),
DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN);
} }
kfree(bufs); kfree(bufs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment