public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH] nvme-pci: remove redundant dma frees in hmb
       [not found] <CGME20250117050925epcas5p1ef46267e6d7dc83ea9d0aa51af934921@epcas5p1.samsung.com>
@ 2025-01-16 23:42 ` francis.p
  2025-01-17  7:54   ` Christoph Hellwig
  2025-01-17 19:22   ` Keith Busch
  0 siblings, 2 replies; 3+ messages in thread
From: francis.p @ 2025-01-16 23:42 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi
  Cc: linux-nvme, anshul, jg123.choi, prakash.bv, d.palani, sathya.m,
	Francis Pravin

From: Francis Pravin <francis.p@samsung.com>

The value of size is 0 when there is no dma buffer allocated. The value
of i also remains 0. So, no need to free the dma buffer in out_free_bufs.
Hence, remove the redundant dma frees.

Signed-off-by: Francis Pravin <francis.p@samsung.com>
---
 drivers/nvme/host/pci.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
index e2634f437f33..924d88edfcd4 100644
--- a/drivers/nvme/host/pci.c
+++ b/drivers/nvme/host/pci.c
@@ -2154,14 +2154,6 @@ static int nvme_alloc_host_mem_multi(struct nvme_dev *dev, u64 preferred,
 	return 0;
 
 out_free_bufs:
-	while (--i >= 0) {
-		size_t size = le32_to_cpu(descs[i].size) * NVME_CTRL_PAGE_SIZE;
-
-		dma_free_attrs(dev->dev, size, bufs[i],
-			       le64_to_cpu(descs[i].addr),
-			       DMA_ATTR_NO_KERNEL_MAPPING | DMA_ATTR_NO_WARN);
-	}
-
 	kfree(bufs);
 out_free_descs:
 	dma_free_coherent(dev->dev, descs_size, descs, descs_dma);
-- 
2.47.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] nvme-pci: remove redundant dma frees in hmb
  2025-01-16 23:42 ` [PATCH] nvme-pci: remove redundant dma frees in hmb francis.p
@ 2025-01-17  7:54   ` Christoph Hellwig
  2025-01-17 19:22   ` Keith Busch
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2025-01-17  7:54 UTC (permalink / raw)
  To: francis.p
  Cc: kbusch, axboe, hch, sagi, linux-nvme, anshul, jg123.choi,
	prakash.bv, d.palani, sathya.m

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] nvme-pci: remove redundant dma frees in hmb
  2025-01-16 23:42 ` [PATCH] nvme-pci: remove redundant dma frees in hmb francis.p
  2025-01-17  7:54   ` Christoph Hellwig
@ 2025-01-17 19:22   ` Keith Busch
  1 sibling, 0 replies; 3+ messages in thread
From: Keith Busch @ 2025-01-17 19:22 UTC (permalink / raw)
  To: francis.p
  Cc: axboe, hch, sagi, linux-nvme, anshul, jg123.choi, prakash.bv,
	d.palani, sathya.m

On Fri, Jan 17, 2025 at 05:12:09AM +0530, francis.p@samsung.com wrote:
> From: Francis Pravin <francis.p@samsung.com>
> 
> The value of size is 0 when there is no dma buffer allocated. The value
> of i also remains 0. So, no need to free the dma buffer in out_free_bufs.
> Hence, remove the redundant dma frees.

THanks, applied to nvme-6.14.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-01-17 19:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CGME20250117050925epcas5p1ef46267e6d7dc83ea9d0aa51af934921@epcas5p1.samsung.com>
2025-01-16 23:42 ` [PATCH] nvme-pci: remove redundant dma frees in hmb francis.p
2025-01-17  7:54   ` Christoph Hellwig
2025-01-17 19:22   ` Keith Busch

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox