output: add thread_cb even if func is null 82/172282/2
authorBoram Park <boram1288.park@samsung.com>
Tue, 13 Mar 2018 03:12:24 +0000 (12:12 +0900)
committerBoram Park <boram1288.park@samsung.com>
Tue, 13 Mar 2018 06:59:36 +0000 (15:59 +0900)
Change-Id: I64eb5588a02ef5d351e9e7debaf7faf00b40f558

src/tdm_output.c

index e6eed12b721907726415dcfe1fee49106e3eed44..652e26257ab01754fd1329f3932b5d0c2b498a16 100644 (file)
@@ -1129,35 +1129,33 @@ tdm_output_commit_internal(tdm_output *output, int sync, tdm_output_commit_handl
        TDM_RETURN_VAL_IF_FAIL(ret == TDM_ERROR_NONE, ret);
 
        if (!TDM_OUTPUT_DPMS_VSYNC_IS_OFF(dpms_value)) {
-               if (func) {
-                       if (!private_output->regist_commit_cb) {
-                               private_output->regist_commit_cb = 1;
-                               ret = func_output->output_set_commit_handler(private_output->output_backend, _tdm_output_cb_commit);
-                               TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, commit_failed);
-                       }
-
-                       output_commit_handler = calloc(1, sizeof(tdm_private_output_commit_handler));
-                       if (!output_commit_handler) {
-                               /* LCOV_EXCL_START */
-                               TDM_ERR("failed: alloc memory");
-                               return TDM_ERROR_OUT_OF_MEMORY;
-                               /* LCOV_EXCL_STOP */
-                       }
-
-                       ret = tdm_thread_cb_add(private_output, TDM_THREAD_CB_OUTPUT_COMMIT, output_commit_handler, _tdm_output_thread_cb_commit, NULL);
-                       if (ret != TDM_ERROR_NONE) {
-                               TDM_ERR("tdm_thread_cb_add failed");
-                               free(output_commit_handler);
-                               return ret;
-                       }
-
-                       LIST_ADDTAIL(&output_commit_handler->link, &private_output->output_commit_handler_list);
-                       output_commit_handler->private_output = private_output;
-                       output_commit_handler->func = func;
-                       output_commit_handler->user_data = user_data;
-                       output_commit_handler->owner_tid = syscall(SYS_gettid);
+               if (!private_output->regist_commit_cb) {
+                       private_output->regist_commit_cb = 1;
+                       ret = func_output->output_set_commit_handler(private_output->output_backend, _tdm_output_cb_commit);
+                       TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, commit_failed);
                }
 
+               output_commit_handler = calloc(1, sizeof(tdm_private_output_commit_handler));
+               if (!output_commit_handler) {
+                       /* LCOV_EXCL_START */
+                       TDM_ERR("failed: alloc memory");
+                       return TDM_ERROR_OUT_OF_MEMORY;
+                       /* LCOV_EXCL_STOP */
+               }
+
+               ret = tdm_thread_cb_add(private_output, TDM_THREAD_CB_OUTPUT_COMMIT, output_commit_handler, _tdm_output_thread_cb_commit, NULL);
+               if (ret != TDM_ERROR_NONE) {
+                       TDM_ERR("tdm_thread_cb_add failed");
+                       free(output_commit_handler);
+                       return ret;
+               }
+
+               LIST_ADDTAIL(&output_commit_handler->link, &private_output->output_commit_handler_list);
+               output_commit_handler->private_output = private_output;
+               output_commit_handler->func = func;
+               output_commit_handler->user_data = user_data;
+               output_commit_handler->owner_tid = syscall(SYS_gettid);
+
                ret = func_output->output_commit(private_output->output_backend, sync,
                                output_commit_handler);
                TDM_GOTO_IF_FAIL(ret == TDM_ERROR_NONE, commit_failed);