tbm_bufmgr: remove the duplicated code 21/260321/1
authorSooChan Lim <sc1.lim@samsung.com>
Wed, 23 Jun 2021 05:36:37 +0000 (14:36 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Wed, 23 Jun 2021 07:14:10 +0000 (16:14 +0900)
Change-Id: I6feb7f196d7a3ab93a32f8de6e9797de5bf5ccc5

src/tbm_bufmgr.c

index aecf23d..6457f16 100644 (file)
@@ -933,8 +933,7 @@ tbm_bufmgr_internal_alloc_bo_with_format(tbm_bufmgr bufmgr, int format, int bo_i
                /* LCOV_EXCL_START */
                TBM_ERR("memory allocationc failed.");
                *error = TBM_ERROR_OUT_OF_MEMORY;
-               _tbm_bufmgr_mutex_unlock();
-               return NULL;
+               goto failed;
                /* LCOV_EXCL_STOP */
        }
 
@@ -942,8 +941,7 @@ tbm_bufmgr_internal_alloc_bo_with_format(tbm_bufmgr bufmgr, int format, int bo_i
        if (!bo->bo_data) {
                /* LCOV_EXCL_START */
                free(bo);
-               _tbm_bufmgr_mutex_unlock();
-               return NULL;
+               goto failed;
                /* LCOV_EXCL_STOP */
        }
 
@@ -952,8 +950,9 @@ tbm_bufmgr_internal_alloc_bo_with_format(tbm_bufmgr bufmgr, int format, int bo_i
        _tbm_bufmgr_mutex_unlock();
 
        return bo;
+
 /* LCOV_EXCL_START */
-fail:
+failed:
        _tbm_bufmgr_mutex_unlock();
 
        return NULL;