egl/drm: make use of the dri2_display_destroy() helper
authorEmil Velikov <emil.velikov@collabora.com>
Thu, 11 May 2017 16:21:13 +0000 (17:21 +0100)
committerEmil Velikov <emil.l.velikov@gmail.com>
Mon, 29 May 2017 15:49:58 +0000 (16:49 +0100)
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Tested-by: Rob Herring <robh@kernel.org>
src/egl/drivers/dri2/platform_drm.c

index 455225e56b000867185149b7f2d4d8df02e18695..80e824f3d54b0250f2307336e46c3c717e5129f7 100644 (file)
@@ -679,6 +679,7 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
    if (!dri2_dpy)
       return _eglError(EGL_BAD_ALLOC, "eglInitialize");
 
+   dri2_dpy->fd = -1;
    disp->DriverData = (void *) dri2_dpy;
 
    gbm = disp->PlatformDisplay;
@@ -760,10 +761,6 @@ dri2_initialize_drm(_EGLDriver *drv, _EGLDisplay *disp)
    return EGL_TRUE;
 
 cleanup:
-   if (fd >= 0)
-      close(fd);
-
-   free(dri2_dpy);
-   disp->DriverData = NULL;
+   dri2_display_destroy(disp);
    return _eglError(EGL_NOT_INITIALIZED, err);
 }