# \[PATCH v2 11/21\] powerpc/iommu: don't set failed sg dma\_address to DMA\_MAPPING\_ERROR

- From: Logan Gunthorpe \<hidden\>
- Date: 2021-07-23 17:51:27 
- List: linux-alpha
- Page: https://ratatoskr.run/linux-alpha/2021/07/1456223
- Thread: https://ratatoskr.run/linux-alpha/2021/07/1456208/t.md

```text
Setting the ->dma_address to DMA_MAPPING_ERROR is not part of
the ->map_sg calling convention, so remove it.

Link: https://lore.kernel.org/linux-mips/20210716063241.GC13345-jcswGhMUV9g@public.gmane.org/
Suggested-by: Christoph Hellwig <redacted>
Signed-off-by: Logan Gunthorpe <redacted>
Cc: Michael Ellerman <redacted>
Cc: Benjamin Herrenschmidt <redacted>
Cc: Paul Mackerras <redacted>
Cc: Geoff Levand <redacted>
---
 arch/powerpc/kernel/iommu.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
index a8ec4fe42817..30b7736f0896 100644
--- a/arch/powerpc/kernel/iommu.c
+++ b/arch/powerpc/kernel/iommu.c
@@ -575,7 +575,6 @@ int ppc_iommu_map_sg(struct device *dev, struct iommu_table *tbl,
 	 */
 	if (outcount < incount) {
 		outs = sg_next(outs);
-		outs->dma_address = DMA_MAPPING_ERROR;
 		outs->dma_length = 0;
 	}
 
@@ -593,7 +592,6 @@ int ppc_iommu_map_sg(struct device *dev, struct iommu_table *tbl,
 			npages = iommu_num_pages(s->dma_address, s->dma_length,
 						 IOMMU_PAGE_SIZE(tbl));
 			__iommu_free(tbl, vaddr, npages);
-			s->dma_address = DMA_MAPPING_ERROR;
 			s->dma_length = 0;
 		}
 		if (s == outs)
-- 
2.20.1
```
