Commit d03c5441 authored by Logan Gunthorpe's avatar Logan Gunthorpe Committed by Christoph Hellwig
Browse files

dma-mapping: disallow .map_sg operations from returning zero on error



Now that all the .map_sg operations have been converted to returning
proper error codes, drop the code to handle a zero return value,
add a warning if a zero is returned.

Signed-off-by: default avatarLogan Gunthorpe <logang@deltatee.com>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 66ab6310
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -197,7 +197,7 @@ static int __dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
	if (ents > 0)
		debug_dma_map_sg(dev, sg, nents, ents, dir);
	else if (WARN_ON_ONCE(ents != -EINVAL && ents != -ENOMEM &&
			      ents != -EIO && ents != 0))
			      ents != -EIO))
		return -EIO;

	return ents;
@@ -261,8 +261,6 @@ int dma_map_sgtable(struct device *dev, struct sg_table *sgt,
	int nents;

	nents = __dma_map_sg_attrs(dev, sgt->sgl, sgt->orig_nents, dir, attrs);
	if (nents == 0)
		return -EIO;
	if (nents < 0)
		return nents;
	sgt->nents = nents;