Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -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)