Преглед на файлове

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: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Laurent Pinchart преди 13 години
родител
ревизия
2ed9201bdd
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  1. 3 2
      drivers/base/dma-buf.c

+ 3 - 2
drivers/base/dma-buf.c

@@ -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)