do not deintialize the display when it fails. 46/259946/1
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 17 Jun 2021 01:51:48 +0000 (10:51 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 17 Jun 2021 01:51:48 +0000 (10:51 +0900)
The deinitialization of the display has to be done outside
initialization function.

Change-Id: I208ec55ad5bf2ec6c6aead0f200c41cbf3d3e949

src/libhal-backend-tdm-exynos/tdm_backend_exynos.c

index 2244618db7b93612de1faff108a83b06d06469f7..af5365082dfefb0dfd6a03662c9f39ba3e62fc46 100644 (file)
@@ -267,7 +267,7 @@ _tdm_exynos_display_initialize(tdm_exynos_display *display_data)
        if (!drm_version) {
                TDM_BACKEND_ERR("no drm version: %m");
                ret = HAL_TDM_ERROR_OPERATION_FAILED;
-               goto failed;
+               goto done;
        } else {
                TDM_BACKEND_INFO("drm version: %d.%d.%d",
                                 drm_version->version_major,
@@ -291,20 +291,20 @@ _tdm_exynos_display_initialize(tdm_exynos_display *display_data)
        if (!display_data->mode_res) {
                TDM_BACKEND_ERR("no drm resource: %m");
                ret = HAL_TDM_ERROR_OPERATION_FAILED;
-               goto failed;
+               goto done;
        }
 
        display_data->plane_res = drmModeGetPlaneResources(display_data->drm_fd);
        if (!display_data->plane_res) {
                TDM_BACKEND_ERR("no drm plane resource: %m");
                ret = HAL_TDM_ERROR_OPERATION_FAILED;
-               goto failed;
+               goto done;
        }
 
        if (display_data->plane_res->count_planes <= 0) {
                TDM_BACKEND_ERR("no drm plane resource");
                ret = HAL_TDM_ERROR_OPERATION_FAILED;
-               goto failed;
+               goto done;
        }
 
        ret = tdm_exynos_display_get_property(display_data,
@@ -321,22 +321,18 @@ _tdm_exynos_display_initialize(tdm_exynos_display *display_data)
        if (display_data->use_ippv2) {
                ret = tdm_exynos_pp_init(display_data);
                if (ret != HAL_TDM_ERROR_NONE)
-                       goto failed;
+                       goto done;
        }
 
        ret = tdm_exynos_display_create_output_list(display_data);
        if (ret != HAL_TDM_ERROR_NONE)
-               goto failed;
+               goto done;
 
        ret = tdm_exynos_display_create_layer_list(display_data);
        if (ret != HAL_TDM_ERROR_NONE)
-               goto failed;
-
-       return ret;
-
-failed:
-       _tdm_exynos_display_deinitialize(display_data);
+               goto done;
 
+done:
        return ret;
 }
 
@@ -465,7 +461,7 @@ hal_backend_tdm_exynos_init(void **data)
 
        // check if drm_fd is master fd.
        drm_fd = _tdm_exynos_open_drm();
-       if (display_data->drm_fd < 0) {
+       if (drm_fd < 0) {
                ret = HAL_TDM_ERROR_OPERATION_FAILED;
                goto failed;
        }