[Mesa-dev] [PATCH] egl/dri2: Fix GCC maybe-uninitialized warning.
Ilia Mirkin
imirkin at alum.mit.edu
Fri Mar 6 23:19:11 PST 2015
On Sat, Mar 7, 2015 at 2:08 AM, Vinson Lee <vlee at freedesktop.org> wrote:
> egl_dri2.c: In function ‘dri2_bind_tex_image’:
> egl_dri2.c:1240:4: warning: ‘format’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> (*dri2_dpy->tex_buffer->setTexBuffer2)(dri2_ctx->dri_context,
> ^
>
> Signed-off-by: Vinson Lee <vlee at freedesktop.org>
> ---
> src/egl/drivers/dri2/egl_dri2.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
> index d503196..88022e0 100644
> --- a/src/egl/drivers/dri2/egl_dri2.c
> +++ b/src/egl/drivers/dri2/egl_dri2.c
> @@ -1227,6 +1227,7 @@ dri2_bind_tex_image(_EGLDriver *drv,
> break;
> default:
> assert(0);
> + format = 0;
How about
_eglError(EGL_BAD_SURFACE, "unrecognized format");
return EGL_FALSE;
And similarly for the TextureTarget below. Note that I don't really
know the code involved, but that seems to make more sense than passing
a bogus format down the line. With that, you could probably also
remove the assert.
-ilia
> }
>
> switch (dri2_surf->base.TextureTarget) {
> --
> 2.3.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list