mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-24 01:41:39 +00:00
dma-buf: Remove unneeded sanity checks
ops, ops->map_dma_buf and ops->unmap_dma_buf are guaranteed to be non-NULL by a check in dma_buf_export(). Remove NULL checks on those variables in the other API functions. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
This commit is contained in:
parent
5375764f94
commit
d1aa06a1ea
1 changed files with 6 additions and 9 deletions
|
@ -185,7 +185,7 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
|
|||
struct dma_buf_attachment *attach;
|
||||
int ret;
|
||||
|
||||
if (WARN_ON(!dmabuf || !dev || !dmabuf->ops))
|
||||
if (WARN_ON(!dmabuf || !dev))
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
attach = kzalloc(sizeof(struct dma_buf_attachment), GFP_KERNEL);
|
||||
|
@ -224,7 +224,7 @@ EXPORT_SYMBOL_GPL(dma_buf_attach);
|
|||
*/
|
||||
void dma_buf_detach(struct dma_buf *dmabuf, struct dma_buf_attachment *attach)
|
||||
{
|
||||
if (WARN_ON(!dmabuf || !attach || !dmabuf->ops))
|
||||
if (WARN_ON(!dmabuf || !attach))
|
||||
return;
|
||||
|
||||
mutex_lock(&dmabuf->lock);
|
||||
|
@ -255,12 +255,11 @@ struct sg_table *dma_buf_map_attachment(struct dma_buf_attachment *attach,
|
|||
|
||||
might_sleep();
|
||||
|
||||
if (WARN_ON(!attach || !attach->dmabuf || !attach->dmabuf->ops))
|
||||
if (WARN_ON(!attach || !attach->dmabuf))
|
||||
return ERR_PTR(-EINVAL);
|
||||
|
||||
mutex_lock(&attach->dmabuf->lock);
|
||||
if (attach->dmabuf->ops->map_dma_buf)
|
||||
sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction);
|
||||
sg_table = attach->dmabuf->ops->map_dma_buf(attach, direction);
|
||||
mutex_unlock(&attach->dmabuf->lock);
|
||||
|
||||
return sg_table;
|
||||
|
@ -278,13 +277,11 @@ EXPORT_SYMBOL_GPL(dma_buf_map_attachment);
|
|||
void dma_buf_unmap_attachment(struct dma_buf_attachment *attach,
|
||||
struct sg_table *sg_table)
|
||||
{
|
||||
if (WARN_ON(!attach || !attach->dmabuf || !sg_table
|
||||
|| !attach->dmabuf->ops))
|
||||
if (WARN_ON(!attach || !attach->dmabuf || !sg_table))
|
||||
return;
|
||||
|
||||
mutex_lock(&attach->dmabuf->lock);
|
||||
if (attach->dmabuf->ops->unmap_dma_buf)
|
||||
attach->dmabuf->ops->unmap_dma_buf(attach, sg_table);
|
||||
attach->dmabuf->ops->unmap_dma_buf(attach, sg_table);
|
||||
mutex_unlock(&attach->dmabuf->lock);
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue