aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2010-04-29 04:37:59 -0400
committerDave Airlie <airlied@redhat.com>2010-05-18 04:21:37 -0400
commitf4b7fb94c576265ceffc43031805ade32fa80c6a (patch)
treeac476c8284396186ab451df7d8a8bc4411b84f03 /drivers/gpu
parent539d24181753e40174746d576d415bfb56131975 (diff)
drm/radeon/kms: take vram mutex pointer before derefing object.
since derefing the object might free it. Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index 06def708b014..a8d18bcae7db 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -168,13 +168,15 @@ void radeon_bo_kunmap(struct radeon_bo *bo)
168void radeon_bo_unref(struct radeon_bo **bo) 168void radeon_bo_unref(struct radeon_bo **bo)
169{ 169{
170 struct ttm_buffer_object *tbo; 170 struct ttm_buffer_object *tbo;
171 struct radeon_device *rdev;
171 172
172 if ((*bo) == NULL) 173 if ((*bo) == NULL)
173 return; 174 return;
175 rdev = (*bo)->rdev;
174 tbo = &((*bo)->tbo); 176 tbo = &((*bo)->tbo);
175 mutex_lock(&(*bo)->rdev->vram_mutex); 177 mutex_lock(&rdev->vram_mutex);
176 ttm_bo_unref(&tbo); 178 ttm_bo_unref(&tbo);
177 mutex_unlock(&(*bo)->rdev->vram_mutex); 179 mutex_unlock(&rdev->vram_mutex);
178 if (tbo == NULL) 180 if (tbo == NULL)
179 *bo = NULL; 181 *bo = NULL;
180} 182}