[Mesa-dev] [PATCH 01/10] egl: simplify refcounting after screen creation

Emil Velikov emil.l.velikov at gmail.com
Sun Aug 27 10:20:26 UTC 2017


From: Emil Velikov <emil.velikov at collabora.com>

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 <emil.velikov at collabora.com>
---
 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.14.0



More information about the mesa-dev mailing list