egl: simplify refcounting after screen creation
authorEmil Velikov <emil.velikov@collabora.com>
Sun, 27 Aug 2017 10:20:26 +0000 (11:20 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Tue, 29 Aug 2017 12:40:46 +0000 (13:40 +0100)
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@collabora.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Acked-by: Daniel Stone <daniels@collabora.com>
src/egl/drivers/dri2/egl_dri2.c

index 83545bab2276abb722807b59b74c78a97bfab76c..02c187e5fe7d313c943ebda99834e0b722a7f22b 100644 (file)
@@ -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;
 }
 
 /**