diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2012-01-26 06:27:25 -0500 |
---|---|---|
committer | Sumit Semwal <sumit.semwal@ti.com> | 2012-03-19 06:12:15 -0400 |
commit | 2ed9201bdd9a8e462d768a838fb2bc944c6887a4 (patch) | |
tree | b205a540211ba7461c82c641c0131e39b11818e3 /drivers | |
parent | a9fbc3b73127efba9276e172daa8d122f0fac1a8 (diff) |
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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/dma-buf.c | 5 |
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, | |||
192 | if (attach == NULL) | 192 | if (attach == NULL) |
193 | return ERR_PTR(-ENOMEM); | 193 | return ERR_PTR(-ENOMEM); |
194 | 194 | ||
195 | mutex_lock(&dmabuf->lock); | ||
196 | |||
197 | attach->dev = dev; | 195 | attach->dev = dev; |
198 | attach->dmabuf = dmabuf; | 196 | attach->dmabuf = dmabuf; |
197 | |||
198 | mutex_lock(&dmabuf->lock); | ||
199 | |||
199 | if (dmabuf->ops->attach) { | 200 | if (dmabuf->ops->attach) { |
200 | ret = dmabuf->ops->attach(dmabuf, dev, attach); | 201 | ret = dmabuf->ops->attach(dmabuf, dev, attach); |
201 | if (ret) | 202 | if (ret) |