diff options
author | Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> | 2015-02-11 07:53:14 -0500 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2015-03-09 08:05:47 -0400 |
commit | 8582e267e9a29ccfd2151c5d74bc2b1440dfb827 (patch) | |
tree | 3b4cae0c874c6a7299e4e27929e0d972a91d5150 /include/asm-generic | |
parent | 9eccca0843205f87c00404b663188b88eb248051 (diff) |
asm/dma-mapping-common: Clarify output of dma_map_sg_attrs
Although dma_map_sg_attrs returns 0 on error and it cannot return a
value < 0, the function returns a signed integer.
Most of the time, this function is used with a scatterlist structure.
This structure uses an unsigned integer for the number of memory.
A dma developer that has not read in detail DMA-API.txt, can wrongly
return a value < 0 on error.
The comment will help the driver developer, and the WARN_ON the dma
developer.
Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Diffstat (limited to 'include/asm-generic')
-rw-r--r-- | include/asm-generic/dma-mapping-common.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h index 3378dcf4c31e..940d5ec122c9 100644 --- a/include/asm-generic/dma-mapping-common.h +++ b/include/asm-generic/dma-mapping-common.h | |||
@@ -39,6 +39,10 @@ static inline void dma_unmap_single_attrs(struct device *dev, dma_addr_t addr, | |||
39 | debug_dma_unmap_page(dev, addr, size, dir, true); | 39 | debug_dma_unmap_page(dev, addr, size, dir, true); |
40 | } | 40 | } |
41 | 41 | ||
42 | /* | ||
43 | * dma_maps_sg_attrs returns 0 on error and > 0 on success. | ||
44 | * It should never return a value < 0. | ||
45 | */ | ||
42 | static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, | 46 | static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, |
43 | int nents, enum dma_data_direction dir, | 47 | int nents, enum dma_data_direction dir, |
44 | struct dma_attrs *attrs) | 48 | struct dma_attrs *attrs) |
@@ -51,6 +55,7 @@ static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg, | |||
51 | kmemcheck_mark_initialized(sg_virt(s), s->length); | 55 | kmemcheck_mark_initialized(sg_virt(s), s->length); |
52 | BUG_ON(!valid_dma_direction(dir)); | 56 | BUG_ON(!valid_dma_direction(dir)); |
53 | ents = ops->map_sg(dev, sg, nents, dir, attrs); | 57 | ents = ops->map_sg(dev, sg, nents, dir, attrs); |
58 | BUG_ON(ents < 0); | ||
54 | debug_dma_map_sg(dev, sg, nents, ents, dir); | 59 | debug_dma_map_sg(dev, sg, nents, ents, dir); |
55 | 60 | ||
56 | return ents; | 61 | return ents; |