tbm_surface_internal: fix wrong last result when tbm_bo_map is failed 40/268940/1
authorChangyeon Lee <cyeon.lee@samsung.com>
Wed, 5 Jan 2022 03:44:52 +0000 (12:44 +0900)
committerChangyeon Lee <cyeon.lee@samsung.com>
Wed, 5 Jan 2022 04:54:11 +0000 (13:54 +0900)
tbm_bo_unmap set ERROR NONE to last result in case of tbm_bo_map is failed

Change-Id: I160d38ebd07020b7b1a5766eacaab7d40c8bb69e

src/tbm_surface_internal.c

index c365f77..7b714ee 100644 (file)
@@ -1387,6 +1387,7 @@ tbm_surface_internal_get_info(tbm_surface_h surface, int opt,
        tbm_bo bos[4];
        int planes_bo_idx[TBM_SURF_PLANE_MAX];
        int i, j;
+       tbm_error_e error;
 
        _tbm_surface_mutex_lock();
        _tbm_set_last_result(TBM_ERROR_NONE);
@@ -1422,9 +1423,11 @@ tbm_surface_internal_get_info(tbm_surface_h surface, int opt,
                for (i = 0; i < num_bos; i++) {
                        bo_handles[i] = tbm_bo_map(bos[i], TBM_DEVICE_CPU, opt);
                        if (bo_handles[i].ptr == NULL) {
+                               error = tbm_get_last_error();
                                for (j = 0; j < i; j++)
                                        tbm_bo_unmap(bos[j]);
 
+                               _tbm_set_last_result(error);
                                TBM_ERR("error: tbm_surface(%p) opt(%d) map(%d)\n", surface, opt, map);
                                return 0;
                        }