drm/i915: Assert that we hold struct_mutex in i915_gem_object_create_from_data()
diff mbox

Message ID 1438090817-19476-1-git-send-email-chris@chris-wilson.co.uk
State New
Headers show

Commit Message

Chris Wilson July 28, 2015, 1:40 p.m. UTC
Unlike the other i915_gem_object create functions, _from_data() requires
the struct_mutex as it also allocates the backing storage and so
interacts with the common lists. Document this requirement.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem.c | 2 ++
 1 file changed, 2 insertions(+)

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 2039798f4403..2bf139396660 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -5226,6 +5226,8 @@  i915_gem_object_create_from_data(struct drm_device *dev,
 	size_t bytes;
 	int ret;
 
+	lockdep_assert_held(&dev->struct_mutex);
+
 	obj = i915_gem_alloc_object(dev, PAGE_ALIGN(size));
 	if (IS_ERR_OR_NULL(obj))
 		return obj;