[PATCH 04/16] drm/mgag200: Don't unreference when handle creation failed

Egbert Eich eich at suse.com
Wed Jul 17 06:07:17 PDT 2013


drm_gem_handle_create() should not have referenced an object when it's
creation has failed for some reason.

Signed-off-by: Egbert Eich <eich at suse.com>
---
 drivers/gpu/drm/mgag200/mgag200_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c
index 43ebf8d..d51096c 100644
--- a/drivers/gpu/drm/mgag200/mgag200_main.c
+++ b/drivers/gpu/drm/mgag200/mgag200_main.c
@@ -302,10 +302,11 @@ int mgag200_dumb_create(struct drm_file *file,
 		return ret;
 
 	ret = drm_gem_handle_create(file, gobj, &handle);
-	drm_gem_object_unreference_unlocked(gobj);
 	if (ret)
 		return ret;
 
+	drm_gem_object_unreference_unlocked(gobj);
+
 	args->handle = handle;
 	return 0;
 }
-- 
1.8.1.4



More information about the dri-devel mailing list