VIGS/YaGL: fixes some code 32/18232/1
authorjinhyung.jo <jinhyung.jo@samsung.com>
Wed, 19 Mar 2014 02:22:30 +0000 (11:22 +0900)
committerjinhyung.jo <jinhyung.jo@samsung.com>
Wed, 19 Mar 2014 06:47:39 +0000 (15:47 +0900)
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 <jinhyung.jo@samsung.com>
hw/vigs/vigs_gl_backend.c
hw/yagl/yagl_device.c
hw/yagl/yagl_server.c

index c20d457..1e26d99 100644 (file)
@@ -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)
index 2b12a46..dccb5c0 100644 (file)
@@ -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);
     }
index 72e46c5..77c9e62 100644 (file)
@@ -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);