From 2f76dff65f83a28b335497ab216a8bb71e6c97a2 Mon Sep 17 00:00:00 2001 From: Emil Velikov Date: Sun, 27 Aug 2017 11:20:26 +0100 Subject: [PATCH] egl: simplify refcounting after screen creation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit If the specific initialize was successfull, dri2_egl_display() will return a non NULL pointer. Thus we can drop the check and flatten the codeflow. Signed-off-by: Emil Velikov Reviewed-by: Tapani Pälli Acked-by: Daniel Stone --- src/egl/drivers/dri2/egl_dri2.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c index 83545bab227..02c187e5fe7 100644 --- a/src/egl/drivers/dri2/egl_dri2.c +++ b/src/egl/drivers/dri2/egl_dri2.c @@ -905,17 +905,13 @@ dri2_initialize(_EGLDriver *drv, _EGLDisplay *disp) return EGL_FALSE; } - if (ret) { - dri2_dpy = dri2_egl_display(disp); - - if (!dri2_dpy) { - return EGL_FALSE; - } + if (!ret) + return EGL_FALSE; - dri2_dpy->ref_count++; - } + dri2_dpy = dri2_egl_display(disp); + dri2_dpy->ref_count++; - return ret; + return EGL_TRUE; } /** -- 2.30.2