mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] spi: spi-qpic-snand: fix DMA unmapping on probe failure
@ 2026-11-14 17:48 Felix Gu
  2026-11-23 18:59 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Gu @ 2026-11-14 17:48 UTC (permalink / raw)
  To: Mark Brown, Sricharan Ramabadhran, Varadarajan Narayanan, Md Sadre Alam
  Cc: linux-spi, linux-kernel, Felix Gu

The probe error path passes the physical MMIO address to
dma_unmap_resource(). This can differ from the DMA address returned
by dma_map_resource(), causing cleanup to unmap the wrong range
and leave the original mapping allocated.

Use snandc->base_dma to unmap the resource, matching the remove path.

Fixes: 7304d1909080 ("spi: spi-qpic: add driver for QCOM SPI NAND flash Interface")
Signed-off-by: Felix Gu <ustc.gu@gmail.com>
---
 drivers/spi/spi-qpic-snand.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/spi/spi-qpic-snand.c b/drivers/spi/spi-qpic-snand.c
index b03e2e4f0f0b..6cb6e02d2498 100644
--- a/drivers/spi/spi-qpic-snand.c
+++ b/drivers/spi/spi-qpic-snand.c
@@ -1668,7 +1668,7 @@ static int qcom_spi_probe(struct platform_device *pdev)
 err_spi_init:
 	qcom_nandc_unalloc(snandc);
 err_snand_alloc:
-	dma_unmap_resource(dev, res->start, resource_size(res),
+	dma_unmap_resource(dev, snandc->base_dma, resource_size(res),
 			   DMA_BIDIRECTIONAL, 0);
 	return ret;
 }

---
base-commit: 793807ca13bf3072fc6d16ce6d90e9ab9beff2a5
change-id: 20261115-qpic-snand-e9f3ef0a9ca5

Best regards,
--  
Felix Gu <ustc.gu@gmail.com>


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

end of thread, other threads:[~2026-11-24 12:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-14 17:48 [PATCH] spi: spi-qpic-snand: fix DMA unmapping on probe failure Felix Gu
2026-11-23 18:59 ` Mark Brown

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

all inboxes | Powered by JetHome®