Skip to content
Snippets Groups Projects
Commit 2ed9201b authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Sumit Semwal
Browse files

dma-buf: Move code out of mutex-protected section in dma_buf_attach()


Some fields can be set without mutex protection. Initialize them before
locking the mutex.

Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarSumit Semwal <sumit.semwal@linaro.org>
parent a9fbc3b7
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment