Commit 2ed9201b authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Sumit Semwal

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
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment