summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tbm_bufmgr_dumb.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/tbm_bufmgr_dumb.c b/src/tbm_bufmgr_dumb.c
index bcff466..32f2a06 100644
--- a/src/tbm_bufmgr_dumb.c
+++ b/src/tbm_bufmgr_dumb.c
@@ -1425,6 +1425,7 @@ tbm_dumb_init(tbm_bufmgr bufmgr, tbm_error_e *error)
tbm_backend_bufmgr_func *bufmgr_func = NULL;
tbm_backend_bo_func *bo_func = NULL;
int fp;
+ int set_master = 0;
tbm_error_e err;
uint64_t cap = 0;
uint32_t ret;
@@ -1459,6 +1460,7 @@ tbm_dumb_init(tbm_bufmgr bufmgr, tbm_error_e *error)
if (drmIsMaster(bufmgr_dumb->fd)) {
tbm_drm_helper_set_tbm_master_fd(bufmgr_dumb->fd);
+ set_master = 1;
bufmgr_dumb->device_name = drmGetDeviceNameFromFd(bufmgr_dumb->fd);
if (!bufmgr_dumb->device_name) {
@@ -1597,10 +1599,9 @@ fail_alloc_bufmgr_func:
free(bufmgr_dumb->device_name);
fail_get_cap:
fail_get_device_name:
- if (tbm_drm_helper_get_master_fd() >= 0)
+ if (set_master)
tbm_drm_helper_unset_tbm_master_fd();
- else
- tbm_drm_helper_unset_fd();
+ tbm_drm_helper_unset_fd();
if (bufmgr_dumb->fd >= 0)
close(bufmgr_dumb->fd);
fail_get_auth_info: