Commit 62af5ca5 authored by Martin Oliveira's avatar Martin Oliveira Committed by Christoph Hellwig

ia64/sba_iommu: return error code from sba_map_sg_attrs()

The .map_sg() op now expects an error code instead of zero on failure.

In the case of a dma_mapping_error() return -EIO as the actual cause
is opaque here.

sba_coalesce_chunks() may only presently fail if sba_alloc_range()
fails, which in turn only fails if the iommu is out of mapping
resources, hence a -ENOMEM is used in that case.
Signed-off-by: default avatarMartin Oliveira <martin.oliveira@eideticom.com>
Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Niklas Schnelle <schnelle@linux.ibm.com>
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 9cf88ec5
...@@ -1459,7 +1459,7 @@ static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist, ...@@ -1459,7 +1459,7 @@ static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist,
sglist->dma_address = sba_map_page(dev, sg_page(sglist), sglist->dma_address = sba_map_page(dev, sg_page(sglist),
sglist->offset, sglist->length, dir, attrs); sglist->offset, sglist->length, dir, attrs);
if (dma_mapping_error(dev, sglist->dma_address)) if (dma_mapping_error(dev, sglist->dma_address))
return 0; return -EIO;
return 1; return 1;
} }
...@@ -1486,7 +1486,7 @@ static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist, ...@@ -1486,7 +1486,7 @@ static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist,
coalesced = sba_coalesce_chunks(ioc, dev, sglist, nents); coalesced = sba_coalesce_chunks(ioc, dev, sglist, nents);
if (coalesced < 0) { if (coalesced < 0) {
sba_unmap_sg_attrs(dev, sglist, nents, dir, attrs); sba_unmap_sg_attrs(dev, sglist, nents, dir, attrs);
return 0; return -ENOMEM;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment