Skip to content

Commit

Permalink
dma-buf: Return error instead of using a goto statement when possible
Browse files Browse the repository at this point in the history
Remove an error label in dma_buf_attach() that just returns an error
code.

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>
  • Loading branch information
Laurent Pinchart authored and Sumit Semwal committed Mar 19, 2012
1 parent d1aa06a commit a9fbc3b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/base/dma-buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,

attach = kzalloc(sizeof(struct dma_buf_attachment), GFP_KERNEL);
if (attach == NULL)
goto err_alloc;
return ERR_PTR(-ENOMEM);

mutex_lock(&dmabuf->lock);

Expand All @@ -206,8 +206,6 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
mutex_unlock(&dmabuf->lock);
return attach;

err_alloc:
return ERR_PTR(-ENOMEM);
err_attach:
kfree(attach);
mutex_unlock(&dmabuf->lock);
Expand Down

0 comments on commit a9fbc3b

Please sign in to comment.