|
@@ -251,9 +251,8 @@ EXPORT_SYMBOL_GPL(dma_buf_put);
|
|
* @dmabuf: [in] buffer to attach device to.
|
|
* @dmabuf: [in] buffer to attach device to.
|
|
* @dev: [in] device to be attached.
|
|
* @dev: [in] device to be attached.
|
|
*
|
|
*
|
|
- * Returns struct dma_buf_attachment * for this attachment; may return negative
|
|
|
|
- * error codes.
|
|
|
|
- *
|
|
|
|
|
|
+ * Returns struct dma_buf_attachment * for this attachment; returns ERR_PTR on
|
|
|
|
+ * error.
|
|
*/
|
|
*/
|
|
struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
|
|
struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
|
|
struct device *dev)
|
|
struct device *dev)
|
|
@@ -319,9 +318,8 @@ EXPORT_SYMBOL_GPL(dma_buf_detach);
|
|
* @attach: [in] attachment whose scatterlist is to be returned
|
|
* @attach: [in] attachment whose scatterlist is to be returned
|
|
* @direction: [in] direction of DMA transfer
|
|
* @direction: [in] direction of DMA transfer
|
|
*
|
|
*
|
|
- * Returns sg_table containing the scatterlist to be returned; may return NULL
|
|
|
|
- * or ERR_PTR.
|
|
|
|
- *
|
|
|
|
|
|
+ * Returns sg_table containing the scatterlist to be returned; returns ERR_PTR
|
|
|
|
+ * on error.
|
|
*/
|
|
*/
|
|
struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
|
|
struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
|
|
enum dma_data_direction direction)
|
|
enum dma_data_direction direction)
|
|
@@ -334,6 +332,8 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
|
|
return ERR_PTR(-EINVAL);
|
|
return ERR_PTR(-EINVAL);
|
|
|
|
|
|
sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction);
|
|
sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction);
|
|
|
|
+ if (!sg_table)
|
|
|
|
+ sg_table = ERR_PTR(-ENOMEM);
|
|
|
|
|
|
return sg_table;
|
|
return sg_table;
|
|
}
|
|
}
|
|
@@ -544,6 +544,8 @@ EXPORT_SYMBOL_GPL(dma_buf_mmap);
|
|
* These calls are optional in drivers. The intended use for them
|
|
* These calls are optional in drivers. The intended use for them
|
|
* is for mapping objects linear in kernel space for high use objects.
|
|
* is for mapping objects linear in kernel space for high use objects.
|
|
* Please attempt to use kmap/kunmap before thinking about these interfaces.
|
|
* Please attempt to use kmap/kunmap before thinking about these interfaces.
|
|
|
|
+ *
|
|
|
|
+ * Returns NULL on error.
|
|
*/
|
|
*/
|
|
void *dma_buf_vmap(struct dma_buf *dmabuf)
|
|
void *dma_buf_vmap(struct dma_buf *dmabuf)
|
|
{
|
|
{
|
|
@@ -566,7 +568,9 @@ void *dma_buf_vmap(struct dma_buf *dmabuf)
|
|
BUG_ON(dmabuf->vmap_ptr);
|
|
BUG_ON(dmabuf->vmap_ptr);
|
|
|
|
|
|
ptr = dmabuf->ops->vmap(dmabuf);
|
|
ptr = dmabuf->ops->vmap(dmabuf);
|
|
- if (IS_ERR_OR_NULL(ptr))
|
|
|
|
|
|
+ if (WARN_ON_ONCE(IS_ERR(ptr)))
|
|
|
|
+ ptr = NULL;
|
|
|
|
+ if (!ptr)
|
|
goto out_unlock;
|
|
goto out_unlock;
|
|
|
|
|
|
dmabuf->vmap_ptr = ptr;
|
|
dmabuf->vmap_ptr = ptr;
|