Merge tag 'for-5.15/parisc' of git://git.kernel.org/pub/scm/linux/kernel/git/deller...
[linux-2.6-microblaze.git] / arch / powerpc / kernel / iommu.c
index 2af89a5..30b7736 100644 (file)
@@ -473,7 +473,7 @@ int ppc_iommu_map_sg(struct device *dev, struct iommu_table *tbl,
        BUG_ON(direction == DMA_NONE);
 
        if ((nelems == 0) || !tbl)
-               return 0;
+               return -EINVAL;
 
        outs = s = segstart = &sglist[0];
        outcount = 1;
@@ -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,13 +592,12 @@ 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)
                        break;
        }
-       return 0;
+       return -EIO;
 }