The code in _eglCreateWindowSurfaceCommon() already has a NULL check
which handles the condition. There's no point in checking again further
down the stack.
v2: Split the WINDOW vs PIXMAP into separate patches
v3: Resolve typos, s/EGL_PIXMAP_BIT_BIT/EGL_PIXMAP_BIT/
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
if (type == EGL_WINDOW_BIT) {
int format;
- if (!window || window->common.magic != ANDROID_NATIVE_WINDOW_MAGIC) {
+ if (window->common.magic != ANDROID_NATIVE_WINDOW_MAGIC) {
_eglError(EGL_BAD_NATIVE_WINDOW, "droid_create_surface");
goto cleanup_surface;
}
switch (type) {
case EGL_WINDOW_BIT:
- if (!window) {
- _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface");
- goto cleanup_surf;
- }
-
surf = gbm_dri_surface(window);
dri2_surf->gbm_surf = surf;
dri2_surf->base.Width = surf->base.width;
dri2_surf->format = WL_SHM_FORMAT_ARGB8888;
}
- if (!window) {
- _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface");
- goto cleanup_surf;
- }
-
dri2_surf->wl_win = window;
dri2_surf->wl_queue = wl_display_create_queue(dri2_dpy->wl_dpy);
if (!dri2_surf->wl_queue) {
dri2_surf->base.Width, dri2_surf->base.Height);
} else {
if (!drawable) {
- if (type == EGL_WINDOW_BIT)
- _eglError(EGL_BAD_NATIVE_WINDOW, "dri2_create_surface");
- else
- _eglError(EGL_BAD_NATIVE_PIXMAP, "dri2_create_surface");
+ assert(type == EGL_PIXMAP_BIT)
+ _eglError(EGL_BAD_NATIVE_PIXMAP, "dri2_create_surface");
goto cleanup_surf;
}
dri2_surf->drawable = drawable;