[PATCH] spi: spi-qpic-snand: fix DMA unmapping on probe failure
From: Felix Gu
Date: Sat Nov 14 2026 - 12:49:00 EST
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@xxxxxxxxx>
---
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@xxxxxxxxx>