On Tuesday, 2017-06-20 16:04:47 +0100, Emil Velikov wrote: > From: Emil Velikov <[email protected]> > > Function cannot fail and always returns true. > > Signed-off-by: Emil Velikov <[email protected]>
Both patches are: Reviewed-by: Eric Engestrom <[email protected]> > --- > We could even inline it in the header if people prefer. Good idea. I just checked that the deref it makes depends on a struct defined before the function prototype in the header, so a trivial replace of the prototype with a static inline should work; consider it r-b'ed as well :) > --- > src/egl/drivers/dri2/egl_dri2.c | 16 +++------------- > src/egl/drivers/dri2/platform_android.c | 5 +---- > src/egl/drivers/dri2/platform_drm.c | 5 +---- > src/egl/drivers/dri2/platform_x11.c | 7 +------ > src/egl/drivers/dri2/platform_x11_dri3.c | 5 +---- > src/egl/main/eglimage.c | 4 +--- > src/egl/main/eglimage.h | 2 +- > 7 files changed, 9 insertions(+), 35 deletions(-) > > diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c > index 020a0bc6394..7b951b7590d 100644 > --- a/src/egl/drivers/dri2/egl_dri2.c > +++ b/src/egl/drivers/dri2/egl_dri2.c > @@ -1676,10 +1676,7 @@ dri2_create_image_from_dri(_EGLDisplay *disp, > __DRIimage *dri_image) > return NULL; > } > > - if (!_eglInitImage(&dri2_img->base, disp)) { > - free(dri2_img); > - return NULL; > - } > + _eglInitImage(&dri2_img->base, disp); > > dri2_img->dri_image = dri_image; > > @@ -1876,11 +1873,7 @@ dri2_create_image_khr_texture(_EGLDisplay *disp, > _EGLContext *ctx, > return EGL_NO_IMAGE_KHR; > } > > - if (!_eglInitImage(&dri2_img->base, disp)) { > - _eglError(EGL_BAD_ALLOC, "dri2_create_image_khr"); > - free(dri2_img); > - return EGL_NO_IMAGE_KHR; > - } > + _eglInitImage(&dri2_img->base, disp); > > dri2_img->dri_image = > dri2_dpy->image->createImageFromTexture(dri2_ctx->dri_context, > @@ -2355,10 +2348,7 @@ dri2_create_drm_image_mesa(_EGLDriver *drv, > _EGLDisplay *disp, > goto cleanup_img; > } > > - if (!_eglInitImage(&dri2_img->base, disp)) { > - err = EGL_BAD_PARAMETER; > - goto cleanup_img; > - } > + _eglInitImage(&dri2_img->base, disp); > > err = _eglParseImageAttribList(&attrs, disp, attr_list); > if (err != EGL_SUCCESS) > diff --git a/src/egl/drivers/dri2/platform_android.c > b/src/egl/drivers/dri2/platform_android.c > index 5550f580a80..8f76ab5f2fc 100644 > --- a/src/egl/drivers/dri2/platform_android.c > +++ b/src/egl/drivers/dri2/platform_android.c > @@ -848,10 +848,7 @@ droid_create_image_from_name(_EGLDisplay *disp, > _EGLContext *ctx, > return NULL; > } > > - if (!_eglInitImage(&dri2_img->base, disp)) { > - free(dri2_img); > - return NULL; > - } > + _eglInitImage(&dri2_img->base, disp); > > dri2_img->dri_image = > dri2_dpy->image->createImageFromName(dri2_dpy->dri_screen, > diff --git a/src/egl/drivers/dri2/platform_drm.c > b/src/egl/drivers/dri2/platform_drm.c > index 8b0562c75d2..df61c0665f9 100644 > --- a/src/egl/drivers/dri2/platform_drm.c > +++ b/src/egl/drivers/dri2/platform_drm.c > @@ -484,10 +484,7 @@ dri2_drm_create_image_khr_pixmap(_EGLDisplay *disp, > _EGLContext *ctx, > return NULL; > } > > - if (!_eglInitImage(&dri2_img->base, disp)) { > - free(dri2_img); > - return NULL; > - } > + _eglInitImage(&dri2_img->base, disp); > > dri2_img->dri_image = dri2_dpy->image->dupImage(dri_bo->image, dri2_img); > if (dri2_img->dri_image == NULL) { > diff --git a/src/egl/drivers/dri2/platform_x11.c > b/src/egl/drivers/dri2/platform_x11.c > index 74d3a164b6a..ca36a56e080 100644 > --- a/src/egl/drivers/dri2/platform_x11.c > +++ b/src/egl/drivers/dri2/platform_x11.c > @@ -1067,12 +1067,7 @@ dri2_create_image_khr_pixmap(_EGLDisplay *disp, > _EGLContext *ctx, > return EGL_NO_IMAGE_KHR; > } > > - if (!_eglInitImage(&dri2_img->base, disp)) { > - free(buffers_reply); > - free(geometry_reply); > - free(dri2_img); > - return EGL_NO_IMAGE_KHR; > - } > + _eglInitImage(&dri2_img->base, disp); > > stride = buffers[0].pitch / buffers[0].cpp; > dri2_img->dri_image = > diff --git a/src/egl/drivers/dri2/platform_x11_dri3.c > b/src/egl/drivers/dri2/platform_x11_dri3.c > index 3148f4904e5..515be27e200 100644 > --- a/src/egl/drivers/dri2/platform_x11_dri3.c > +++ b/src/egl/drivers/dri2/platform_x11_dri3.c > @@ -327,10 +327,7 @@ dri3_create_image_khr_pixmap(_EGLDisplay *disp, > _EGLContext *ctx, > return EGL_NO_IMAGE_KHR; > } > > - if (!_eglInitImage(&dri2_img->base, disp)) { > - free(dri2_img); > - return EGL_NO_IMAGE_KHR; > - } > + _eglInitImage(&dri2_img->base, disp); > > dri2_img->dri_image = loader_dri3_create_image(dri2_dpy->conn, > bp_reply, > diff --git a/src/egl/main/eglimage.c b/src/egl/main/eglimage.c > index c558f2f02b0..9e3c4b7e582 100644 > --- a/src/egl/main/eglimage.c > +++ b/src/egl/main/eglimage.c > @@ -247,10 +247,8 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, > _EGLDisplay *dpy, > } > > > -EGLBoolean > +void > _eglInitImage(_EGLImage *img, _EGLDisplay *dpy) > { > _eglInitResource(&img->Resource, sizeof(*img), dpy); > - > - return EGL_TRUE; > } > diff --git a/src/egl/main/eglimage.h b/src/egl/main/eglimage.h > index eb66280ff96..18878249a40 100644 > --- a/src/egl/main/eglimage.h > +++ b/src/egl/main/eglimage.h > @@ -96,7 +96,7 @@ _eglParseImageAttribList(_EGLImageAttribs *attrs, > _EGLDisplay *dpy, > const EGLint *attrib_list); > > > -extern EGLBoolean > +extern void > _eglInitImage(_EGLImage *img, _EGLDisplay *dpy); > > > -- > 2.13.0 > _______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
