MLK-22600-2 drm/imx: dpu: plane: Improve bailout path of dpu_plane_init()
authorLiu Ying <victor.liu@nxp.com>
Thu, 12 Sep 2019 06:24:56 +0000 (14:24 +0800)
committerLiu Ying <victor.liu@nxp.com>
Fri, 20 Sep 2019 02:01:31 +0000 (10:01 +0800)
This patch improves bailout path of dpu_plane_init().
As we'll add more drm properties to the planes later,
this would simply the code.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit 1a6ab9246b5d6e71e8a4a0a0b5ea15d7af0c9879)

drivers/gpu/drm/imx/dpu/dpu-plane.c

index e26b8bc..c07ea06 100644 (file)
@@ -881,10 +881,8 @@ struct dpu_plane *dpu_plane_init(struct drm_device *drm,
                                               ARRAY_SIZE(dpu_overlay_formats),
                                               dpu_format_modifiers,
                                               type, NULL);
-       if (ret) {
-               kfree(dpu_plane);
-               return ERR_PTR(ret);
-       }
+       if (ret)
+               goto err;
 
        drm_plane_helper_add(plane, &dpu_plane_helper_funcs);
 
@@ -902,10 +900,12 @@ struct dpu_plane *dpu_plane_init(struct drm_device *drm,
                ret = -EINVAL;
        }
 
-       if (ret) {
-               kfree(dpu_plane);
-               return ERR_PTR(ret);
-       }
+       if (ret)
+               goto err;
 
        return dpu_plane;
+
+err:
+       kfree(dpu_plane);
+       return ERR_PTR(ret);
 }