Skip to content

Commit d03c544

Browse files
lsgunthChristoph Hellwig
authored andcommitted
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 <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 66ab631 commit d03c544

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

kernel/dma/mapping.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ static int __dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
197197
if (ents > 0)
198198
debug_dma_map_sg(dev, sg, nents, ents, dir);
199199
else if (WARN_ON_ONCE(ents != -EINVAL && ents != -ENOMEM &&
200-
ents != -EIO && ents != 0))
200+
ents != -EIO))
201201
return -EIO;
202202

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

263263
nents = __dma_map_sg_attrs(dev, sgt->sgl, sgt->orig_nents, dir, attrs);
264-
if (nents == 0)
265-
return -EIO;
266264
if (nents < 0)
267265
return nents;
268266
sgt->nents = nents;

0 commit comments

Comments
 (0)