summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/base/dma-buf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/base/dma-buf.c b/drivers/base/dma-buf.c
index 97450a52172c..8afe2dd17912 100644
--- a/drivers/base/dma-buf.c
+++ b/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)