From a83ceec868a6d544bc7775a753b67aa40d0d0efc Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Mon, 2 Apr 2018 16:41:15 +0100 Subject: [PATCH] dri3: simplify dri3_open() implementation Reviewed-by: Adam Jackson Signed-off-by: Emil Velikov --- dri3/dri3_screen.c | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/dri3/dri3_screen.c b/dri3/dri3_screen.c index 58f5ff71d..1257c0ef4 100644 --- a/dri3/dri3_screen.c +++ b/dri3/dri3_screen.c @@ -32,33 +32,21 @@ #include #include -static inline Bool has_open(const dri3_screen_info_rec *info) { - if (info == NULL) - return FALSE; - - return info->open != NULL || - (info->version >= 1 && info->open_client != NULL); -} - int dri3_open(ClientPtr client, ScreenPtr screen, RRProviderPtr provider, int *fd) { dri3_screen_priv_ptr ds = dri3_screen_priv(screen); const dri3_screen_info_rec *info = ds->info; - int rc; - if (!has_open(info)) + if (info == NULL) return BadMatch; if (info->version >= 1 && info->open_client != NULL) - rc = (*info->open_client) (client, screen, provider, fd); - else - rc = (*info->open) (screen, provider, fd); + return (*info->open_client) (client, screen, provider, fd); + if (info->open != NULL) + return (*info->open) (screen, provider, fd); - if (rc != Success) - return rc; - - return Success; + return BadMatch; } int