From: Markus Elfring <elfr...@users.sourceforge.net>
Date: Tue, 24 Oct 2017 09:50:54 +0200

Adjust jump targets so that a bit of exception handling can be better
reused at the end of this function.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfr...@users.sourceforge.net>
---
 drivers/gpu/drm/exynos/exynos_drm_gem.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c 
b/drivers/gpu/drm/exynos/exynos_drm_gem.c
index 077de014d610..1b3c9324cdd5 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_gem.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c
@@ -208,20 +208,22 @@ static struct exynos_drm_gem *exynos_drm_gem_init(struct 
drm_device *dev,
        ret = drm_gem_object_init(dev, obj, size);
        if (ret < 0) {
                DRM_ERROR("failed to initialize gem object\n");
-               kfree(exynos_gem);
-               return ERR_PTR(ret);
+               goto free_gem;
        }
 
        ret = drm_gem_create_mmap_offset(obj);
-       if (ret < 0) {
-               drm_gem_object_release(obj);
-               kfree(exynos_gem);
-               return ERR_PTR(ret);
-       }
+       if (ret < 0)
+               goto release_object;
 
        DRM_DEBUG_KMS("created file object = %pK\n", obj->filp);
 
        return exynos_gem;
+
+release_object:
+       drm_gem_object_release(obj);
+free_gem:
+       kfree(exynos_gem);
+       return ERR_PTR(ret);
 }
 
 struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev,
-- 
2.14.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to