[PATCH] drm/gem-shmem: When drm_gem_object_init failed, should release object

ChunyouTang tangchunyou at 163.com
Tue Nov 8 02:03:21 UTC 2022


when goto err_free, the object had init, so it should be release when fail.

Signed-off-by: ChunyouTang <tangchunyou at 163.com>
---
 drivers/gpu/drm/drm_gem_shmem_helper.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/drm_gem_shmem_helper.c b/drivers/gpu/drm/drm_gem_shmem_helper.c
index 35138f8a375c..2e5e3207355f 100644
--- a/drivers/gpu/drm/drm_gem_shmem_helper.c
+++ b/drivers/gpu/drm/drm_gem_shmem_helper.c
@@ -104,10 +104,10 @@ __drm_gem_shmem_create(struct drm_device *dev, size_t size, bool private)
 
 	return shmem;
 
-err_release:
-	drm_gem_object_release(obj);
 err_free:
 	kfree(obj);
+err_release:
+	drm_gem_object_release(obj);
 
 	return ERR_PTR(ret);
 }
-- 
2.25.1



More information about the dri-devel mailing list