mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-12-03 09:20:14 -05:00
drm/gem: Check locking in drm_gem_object_unreference
Pretty soon only some drivers will need dev->struct_mutex in their gem_free_object callbacks. Hence it's really important to make sure everything still keeps getting this right. v2: Don't check for locking before we check for non-NULL obj. Spotted by Dan Carpenter. Link: http://mid.gmane.org/[email protected] Reviewed-by: David Herrmann <[email protected]> Signed-off-by: Daniel Vetter <[email protected]>
This commit is contained in:
parent
4e270f0880
commit
ef4c6270bf
1 changed files with 4 additions and 1 deletions
|
|
@ -142,8 +142,11 @@ drm_gem_object_reference(struct drm_gem_object *obj)
|
|||
static inline void
|
||||
drm_gem_object_unreference(struct drm_gem_object *obj)
|
||||
{
|
||||
if (obj != NULL)
|
||||
if (obj != NULL) {
|
||||
WARN_ON(!mutex_is_locked(&obj->dev->struct_mutex));
|
||||
|
||||
kref_put(&obj->refcount, drm_gem_object_free);
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
|
|||
Loading…
Reference in a new issue