Module: Mesa
Branch: master
Commit: 2f76dff65f83a28b335497ab216a8bb71e6c97a2
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=2f76dff65f83a28b335497ab216a8bb71e6c97a2

Author: Emil Velikov <[email protected]>
Date:   Sun Aug 27 11:20:26 2017 +0100

egl: simplify refcounting after screen creation

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 <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Acked-by: Daniel Stone <[email protected]>

---

 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 83545bab22..02c187e5fe 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;
 }
 
 /**

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to