提交 a9fbc3b7 编写于 作者: L Laurent Pinchart 提交者: Sumit Semwal

dma-buf: Return error instead of using a goto statement when possible

Remove an error label in dma_buf_attach() that just returns an error
code.
Signed-off-by: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: NSumit Semwal <sumit.semwal@linaro.org>
上级 d1aa06a1
...@@ -190,7 +190,7 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, ...@@ -190,7 +190,7 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
attach = kzalloc(sizeof(struct dma_buf_attachment), GFP_KERNEL); attach = kzalloc(sizeof(struct dma_buf_attachment), GFP_KERNEL);
if (attach == NULL) if (attach == NULL)
goto err_alloc; return ERR_PTR(-ENOMEM);
mutex_lock(&dmabuf->lock); mutex_lock(&dmabuf->lock);
...@@ -206,8 +206,6 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf, ...@@ -206,8 +206,6 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
mutex_unlock(&dmabuf->lock); mutex_unlock(&dmabuf->lock);
return attach; return attach;
err_alloc:
return ERR_PTR(-ENOMEM);
err_attach: err_attach:
kfree(attach); kfree(attach);
mutex_unlock(&dmabuf->lock); mutex_unlock(&dmabuf->lock);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册