summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/radeon_gem.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c
index 723cd19cd22f..aa1ca2dea42f 100644
--- a/drivers/gpu/drm/radeon/radeon_gem.c
+++ b/drivers/gpu/drm/radeon/radeon_gem.c
@@ -358,6 +358,7 @@ int radeon_mode_dumb_create(struct drm_file *file_priv,
{
struct radeon_device *rdev = dev->dev_private;
struct drm_gem_object *gobj;
+ uint32_t handle;
int r;
args->pitch = radeon_align_pitch(rdev, args->width, args->bpp, 0) * ((args->bpp + 1) / 8);
@@ -371,12 +372,13 @@ int radeon_mode_dumb_create(struct drm_file *file_priv,
if (r)
return -ENOMEM;
- r = drm_gem_handle_create(file_priv, gobj, &args->handle);
+ r = drm_gem_handle_create(file_priv, gobj, &handle);
+ /* drop reference from allocate - handle holds it now */
+ drm_gem_object_unreference_unlocked(gobj);
if (r) {
- drm_gem_object_unreference_unlocked(gobj);
return r;
}
- drm_gem_object_handle_unreference_unlocked(gobj);
+ args->handle = handle;
return 0;
}