- if (bo->bufmgr->use_hal_tbm) {
- hal_tbm_bo_handle hbo_handle;
- hbo_handle = hal_tbm_bo_map((hal_tbm_bo *)bo->bo_data, device, opt, (hal_tbm_error *)&error);
- if (hbo_handle.ptr == NULL) {
- /* LCOV_EXCL_START */
- _tbm_set_last_result(error);
- TBM_ERR("error: bo(%p) bo_handle(%p) error(%d)\n", bo, hbo_handle.ptr, error);
- goto bo_map_fail;
- /* LCOV_EXCL_STOP */
- }
- memcpy(&bo_handle.ptr, &hbo_handle.ptr, sizeof(tbm_bo_handle));
- } else if (bo->bufmgr->backend_module_data) {
- bo_handle = bo->bufmgr->bo_func->bo_map(bo->bo_data, device, opt, &error);
- if (bo_handle.ptr == NULL) {
- /* LCOV_EXCL_START */
- _tbm_set_last_result(error);
- TBM_ERR("error: fail to map bo:%p error:%d\n", bo, error);
- goto bo_map_fail;
- /* LCOV_EXCL_STOP */
- }
- } else {
- bo_handle = bo->bufmgr->backend->bo_map(bo, device, opt);
- if (bo_handle.ptr == NULL) {
- /* LCOV_EXCL_START */
- _tbm_set_last_result(TBM_ERROR_INVALID_OPERATION);
- TBM_ERR("error: fail to map bo:%p\n", bo);
- goto bo_map_fail;
- /* LCOV_EXCL_STOP */
- }
+ bo_handle = tbm_bo_data_map(bo->bo_data, device, opt, &error);
+ if (bo_handle.ptr == NULL) {
+ /* LCOV_EXCL_START */
+ TBM_ERR("error: fail to map bo:%p error:%d\n", bo, error);
+ _tbm_set_last_result(error);
+ _tbm_bo_unlock(bo);
+ _tbm_bufmgr_mutex_unlock();
+ return (tbm_bo_handle) NULL;
+ /* LCOV_EXCL_STOP */