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: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:
Logan Gunthorpe 2021-08-09 17:13:31 +02:00 коммит произвёл Christoph Hellwig
Родитель 66ab63104f
Коммит d03c544192
1 изменённых файлов: 1 добавлений и 3 удалений

Просмотреть файл

@ -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;