From: Eric Engestrom Date: Tue, 8 Jan 2019 11:14:35 +0000 (+0000) Subject: egl: move bad_param check further up X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=64c7c05b71a7f15890fe75f6d8f5ac1a860808ec;p=mesa.git egl: move bad_param check further up This way other functions added in these entrypoints don't need to check anything. Signed-off-by: Eric Engestrom Reviewed-by: Emil Velikov Reviewed-by: Tapani Pälli --- diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c index ed160e65b20..93c1da9aac0 100644 --- a/src/egl/main/eglapi.c +++ b/src/egl/main/eglapi.c @@ -721,6 +721,10 @@ eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); + + if (!num_config) + RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); + ret = drv->API.GetConfigs(drv, disp, configs, config_size, num_config); RETURN_EGL_EVAL(disp, ret); @@ -738,6 +742,10 @@ eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, _EGL_FUNC_START(disp, EGL_OBJECT_DISPLAY_KHR, NULL, EGL_FALSE); _EGL_CHECK_DISPLAY(disp, EGL_FALSE, drv); + + if (!num_config) + RETURN_EGL_ERROR(disp, EGL_BAD_PARAMETER, EGL_FALSE); + ret = drv->API.ChooseConfig(drv, disp, attrib_list, configs, config_size, num_config); diff --git a/src/egl/main/eglconfig.c b/src/egl/main/eglconfig.c index 72cd73d5179..0a95e8ee05d 100644 --- a/src/egl/main/eglconfig.c +++ b/src/egl/main/eglconfig.c @@ -737,9 +737,6 @@ _eglFilterConfigArray(_EGLArray *array, EGLConfig *configs, _EGLConfig **configList; EGLint i, count; - if (!num_configs) - return _eglError(EGL_BAD_PARAMETER, "eglChooseConfig"); - /* get the number of matched configs */ count = _eglFilterArray(array, NULL, 0, (_EGLArrayForEach) match, priv_data); @@ -851,9 +848,6 @@ EGLBoolean _eglGetConfigs(_EGLDriver *drv, _EGLDisplay *disp, EGLConfig *configs, EGLint config_size, EGLint *num_config) { - if (!num_config) - return _eglError(EGL_BAD_PARAMETER, "eglGetConfigs"); - *num_config = _eglFlattenArray(disp->Configs, (void *) configs, sizeof(configs[0]), config_size, _eglFlattenConfig);