From ed13b92f4db8bb6ca7199f6016fa619753bed432 Mon Sep 17 00:00:00 2001 From: "jinhyung.jo" Date: Wed, 19 Mar 2014 11:22:30 +0900 Subject: [PATCH] VIGS/YaGL: fixes some code yagl_server.c Add a null-pointer checking statement yagl_device.c & vigs_gl_backend.c Remove statements that is not used, because the conditions cannot be true. Change-Id: Iee478bf6caafe5dab352f26afc4c3ac1413f6ef4 Signed-off-by: Jinhyung Jo --- hw/vigs/vigs_gl_backend.c | 17 ++--------------- hw/yagl/yagl_device.c | 4 ---- hw/yagl/yagl_server.c | 16 +++++++++------- 3 files changed, 11 insertions(+), 26 deletions(-) diff --git a/hw/vigs/vigs_gl_backend.c b/hw/vigs/vigs_gl_backend.c index c20d457..1e26d99 100644 --- a/hw/vigs/vigs_gl_backend.c +++ b/hw/vigs/vigs_gl_backend.c @@ -1057,14 +1057,14 @@ static struct vigs_surface *vigs_gl_backend_create_surface(struct vigs_backend * break; default: assert(false); - goto fail; + return NULL; } tex_bpp = vigs_format_bpp(format); if ((width * tex_bpp) != stride) { VIGS_LOG_ERROR("Custom strides not supported yet"); - goto fail; + return NULL; } gl_sfc = g_malloc0(sizeof(*gl_sfc)); @@ -1096,19 +1096,6 @@ static struct vigs_surface *vigs_gl_backend_create_surface(struct vigs_backend * gl_sfc->base.destroy = &vigs_gl_surface_destroy; return &gl_sfc->base; - -fail: - if (ws_sfc) { - vigs_winsys_gl_surface_orphan(ws_sfc); - } - - if (gl_sfc) { - vigs_surface_cleanup(&gl_sfc->base); - - g_free(gl_sfc); - } - - return NULL; } static void vigs_gl_backend_read_pixels_work(struct work_queue_item *wq_item) diff --git a/hw/yagl/yagl_device.c b/hw/yagl/yagl_device.c index 2b12a46..dccb5c0 100644 --- a/hw/yagl/yagl_device.c +++ b/hw/yagl/yagl_device.c @@ -290,10 +290,6 @@ static int yagl_device_init(PCIDevice *dev) return 0; fail: - if (egl_backend) { - egl_backend->destroy(egl_backend); - } - if (gles_driver) { gles_driver->destroy(gles_driver); } diff --git a/hw/yagl/yagl_server.c b/hw/yagl/yagl_server.c index 72e46c5..77c9e62 100644 --- a/hw/yagl/yagl_server.c +++ b/hw/yagl/yagl_server.c @@ -340,15 +340,17 @@ void yagl_server_dispatch_update(struct yagl_server_state *ss, goto out; fail: - for (i = count; i > 0; --i) { - if (pages[i - 1]) { - cpu_physical_memory_unmap(pages[i - 1], - TARGET_PAGE_SIZE, - false, - TARGET_PAGE_SIZE); + if (pages) { + for (i = count; i > 0; --i) { + if (pages[i - 1]) { + cpu_physical_memory_unmap(pages[i - 1], + TARGET_PAGE_SIZE, + false, + TARGET_PAGE_SIZE); + } } + g_free(pages); } - g_free(pages); out: YAGL_LOG_FUNC_EXIT(NULL); -- 2.7.4