提交 2ed9201b 编写于 作者: L Laurent Pinchart 提交者: 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: NLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: NSumit Semwal <sumit.semwal@linaro.org>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册