summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChangyeon Lee <cyeon.lee@samsung.com>2017-02-08 14:53:17 +0900
committerChangyeon Lee <cyeon.lee@samsung.com>2017-02-08 14:58:43 +0900
commit329a5c348f7f68c2e2c2c66f71f979e8025551d5 (patch)
tree37fc468fa2c4f224c6d678103e8f24356b4b09ac
parent9bbf9ee9037c38270f8268a6623d375607102fab (diff)
downloadlibtbm-dumb-329a5c348f7f68c2e2c2c66f71f979e8025551d5.tar.gz
libtbm-dumb-329a5c348f7f68c2e2c2c66f71f979e8025551d5.tar.bz2
libtbm-dumb-329a5c348f7f68c2e2c2c66f71f979e8025551d5.zip
remove white space and clean up init bufmgr
Change-Id: I10deb32d18943566e53acce049a53684e57ea194
-rw-r--r--src/tbm_bufmgr_dumb.c70
1 files changed, 29 insertions, 41 deletions
diff --git a/src/tbm_bufmgr_dumb.c b/src/tbm_bufmgr_dumb.c
index a0974cd..9f4b0b9 100644
--- a/src/tbm_bufmgr_dumb.c
+++ b/src/tbm_bufmgr_dumb.c
@@ -1479,18 +1479,18 @@ int
tbm_dumb_bufmgr_bind_native_display (tbm_bufmgr bufmgr, void *native_display)
{
tbm_bufmgr_dumb bufmgr_dumb;
-
+
bufmgr_dumb = tbm_backend_get_priv_from_bufmgr(bufmgr);
DUMB_RETURN_VAL_IF_FAIL(bufmgr_dumb != NULL, 0);
-
+
if (!tbm_drm_helper_wl_auth_server_init(native_display, bufmgr_dumb->fd,
bufmgr_dumb->device_name, 0)) {
TBM_DUMB_LOG("error:Fail to tbm_drm_helper_wl_server_init\n");
return 0;
}
-
+
bufmgr_dumb->bind_display = native_display;
-
+
return 1;
}
@@ -1529,43 +1529,30 @@ init_tbm_bufmgr_priv (tbm_bufmgr bufmgr, int fd)
return 0;
}
- if (tbm_backend_is_display_server()) {
+ if (tbm_backend_is_display_server()) {
bufmgr_dumb->fd = tbm_drm_helper_get_master_fd();
if (bufmgr_dumb->fd < 0) {
bufmgr_dumb->fd = _tbm_dumb_open_drm();
}
-
+
if (bufmgr_dumb->fd < 0) {
TBM_DUMB_LOG ("error:Fail to create drm!\n");
- free (bufmgr_dumb);
- return 0;
+ goto fail_open_drm;
}
tbm_drm_helper_set_tbm_master_fd(bufmgr_dumb->fd);
-
+
bufmgr_dumb->device_name = drmGetDeviceNameFromFd(bufmgr_dumb->fd);
-
if (!bufmgr_dumb->device_name)
{
TBM_DUMB_LOG ("error:Fail to get device name!\n");
-
- tbm_drm_helper_unset_tbm_master_fd();
-
- close(bufmgr_dumb->fd);
-
- free (bufmgr_dumb);
- return 0;
+ goto fail_get_device_name;
}
} else {
if (!tbm_drm_helper_get_auth_info(&(bufmgr_dumb->fd), &(bufmgr_dumb->device_name), NULL)) {
TBM_DUMB_LOG ("error:Fail to get auth drm info!\n");
-
- if (bufmgr_dumb->fd >= 0)
- close(bufmgr_dumb->fd);
-
- free (bufmgr_dumb);
- return 0;
+ goto fail_get_auth_info;
}
}
@@ -1590,16 +1577,7 @@ init_tbm_bufmgr_priv (tbm_bufmgr bufmgr, int fd)
if (!bufmgr_backend)
{
TBM_DUMB_LOG ("error: Fail to create drm!\n");
- if (bufmgr_dumb->hashBos)
- drmHashDestroy (bufmgr_dumb->hashBos);
-
- if (tbm_backend_is_display_server())
- tbm_drm_helper_unset_tbm_master_fd();
-
- close(bufmgr_dumb->fd);
-
- free (bufmgr_dumb);
- return 0;
+ goto fail_alloc_backend;
}
bufmgr_backend->priv = (void *)bufmgr_dumb;
@@ -1624,14 +1602,7 @@ init_tbm_bufmgr_priv (tbm_bufmgr bufmgr, int fd)
if (!tbm_backend_init (bufmgr, bufmgr_backend))
{
TBM_DUMB_LOG ("error: Fail to init backend!\n");
-
- if (tbm_backend_is_display_server())
- tbm_drm_helper_unset_tbm_master_fd();
-
- close(bufmgr_dumb->fd);
-
- tbm_backend_free (bufmgr_backend);
- free (bufmgr_dumb);
+ goto fail_init_backend;
return 0;
}
@@ -1658,6 +1629,23 @@ init_tbm_bufmgr_priv (tbm_bufmgr bufmgr, int fd)
bufmgr_dumb->fd);
return 1;
+
+fail_init_backend:
+ tbm_backend_free(bufmgr_backend);
+fail_alloc_backend:
+ if (bufmgr_dumb->hashBos)
+ drmHashDestroy(bufmgr_dumb->hashBos);
+ if (bufmgr_dumb->device_name)
+ free(bufmgr_dumb->device_name);
+fail_get_device_name:
+ if (tbm_backend_is_display_server())
+ tbm_drm_helper_unset_tbm_master_fd();
+ if (bufmgr_dumb->fd >= 0)
+ close(bufmgr_dumb->fd);
+fail_get_auth_info:
+fail_open_drm:
+ free(bufmgr_dumb);
+ return 0;
}