Skip to content

Commit

Permalink
dma-buf: Move code out of mutex-protected section in dma_buf_attach()
Browse files Browse the repository at this point in the history
Some fields can be set without mutex protection. Initialize them before
locking the mutex.

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 a9fbc3b commit 2ed9201
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/base/dma-buf.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,11 @@ struct dma_buf_attachment *dma_buf_attach(struct dma_buf *dmabuf,
if (attach == NULL)
return ERR_PTR(-ENOMEM);

mutex_lock(&dmabuf->lock);

attach->dev = dev;
attach->dmabuf = dmabuf;

mutex_lock(&dmabuf->lock);

if (dmabuf->ops->attach) {
ret = dmabuf->ops->attach(dmabuf, dev, attach);
if (ret)
Expand Down

0 comments on commit 2ed9201

Please sign in to comment.