drm-output: fix unchecked return value of drm_output_destroy 76/173276/2
authorJuyeon Lee <juyeonne.lee@samsung.com>
Tue, 20 Mar 2018 08:18:24 +0000 (17:18 +0900)
committerJuyeon Lee <juyeonne.lee@samsung.com>
Tue, 20 Mar 2018 08:19:41 +0000 (17:19 +0900)
Change-Id: I086c7c726f80423df4aa92fbfed89227108cb9b1

src/lib/drm/drm-output.c

index 78bfa3f..bdcc398 100644 (file)
@@ -941,53 +941,55 @@ error:
 void
 drm_output_destroy(void *o)
 {
-       int           i;
-       drm_output_t *output = o;
-       drm_plane_t  *plane;
-
-       if (output->page_flip_pending || (output->vblank_pending_count > 0)) {
-               output->destroy_pending = PEPPER_TRUE;
-               return;
-       }
-
-       for (i = 0; i < 2; i++) {
-               if (output->cursor_bo[i])
-                       gbm_bo_destroy(output->cursor_bo[i]);
-       }
-
-       if (output->render_type == DRM_RENDER_TYPE_PIXMAN)
-               fini_pixman_renderer(output);
-       else if (output->render_type == DRM_RENDER_TYPE_GL)
-               fini_gl_renderer(output);
-
-       if (output->saved_crtc) {
-               if (drmModeSetCrtc(output->conn->drm->fd,
-                                          output->saved_crtc->crtc_id,
-                                          output->saved_crtc->buffer_id,
-                                          output->saved_crtc->x, output->saved_crtc->y,
-                                          &output->conn->connector->connector_id, 1, &output->saved_crtc->mode))
-                       PEPPER_ERROR("drmModeSetCrtc was failed.\n");
-               drmModeFreeCrtc(output->saved_crtc);
-       }
-
-       if (output->fb_plane)
-               pepper_plane_destroy(output->fb_plane);
-
-       if (output->primary_plane)
-               pepper_plane_destroy(output->primary_plane);
-
-       /* Release all planes. */
-       pepper_list_for_each(plane, &output->drm->plane_list, link) {
-               if (plane->output == output) {
-                       plane->output = NULL;
-                       pepper_plane_destroy(plane->base);
-                       drmModeSetPlane(output->drm->fd, plane->id, output->crtc_id,
-                                                       0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
-               }
-       }
-
-       /* destroy renderer. */
-       free(output);
+   int           i;
+   drm_output_t *output = o;
+   drm_plane_t  *plane;
+
+   if (output->page_flip_pending || (output->vblank_pending_count > 0)) {
+        output->destroy_pending = PEPPER_TRUE;
+        return;
+   }
+
+   for (i = 0; i < 2; i++) {
+        if (output->cursor_bo[i])
+          gbm_bo_destroy(output->cursor_bo[i]);
+   }
+
+   if (output->render_type == DRM_RENDER_TYPE_PIXMAN)
+     fini_pixman_renderer(output);
+   else if (output->render_type == DRM_RENDER_TYPE_GL)
+     fini_gl_renderer(output);
+
+   if (output->saved_crtc) {
+        if (drmModeSetCrtc(output->conn->drm->fd,
+                           output->saved_crtc->crtc_id,
+                           output->saved_crtc->buffer_id,
+                           output->saved_crtc->x, output->saved_crtc->y,
+                           &output->conn->connector->connector_id, 1, &output->saved_crtc->mode))
+          PEPPER_ERROR("drmModeSetCrtc was failed.\n");
+        drmModeFreeCrtc(output->saved_crtc);
+   }
+
+   if (output->fb_plane)
+     pepper_plane_destroy(output->fb_plane);
+
+   if (output->primary_plane)
+     pepper_plane_destroy(output->primary_plane);
+
+   /* Release all planes. */
+   pepper_list_for_each(plane, &output->drm->plane_list, link) {
+        int ret;
+        if (plane->output == output) {
+             plane->output = NULL;
+             pepper_plane_destroy(plane->base);
+             ret = drmModeSetPlane(output->drm->fd, plane->id, output->crtc_id,
+                                   0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+             PEPPER_CHECK(ret == 0, continue, "drmModeSetPlane() failed.\n");
+        }
+   }
+
+   /* destroy renderer. */
+   free(output);
 }
 
 void